Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Petrol.Type
SourceRepresents an SQL data type that maps to an OCaml type 'a
.
custom ~ty ~repr
creates a new SQL type that is represented by the Caqti type ty
, and is represented in a SQL query as repr
.
For example, you might define the BOOL datatype as follows:
let bool = Type.custom ~ty:Caqti_type.bool ~repr:"BOOLEAN"
Note Petrol doesn't implement the boolean type using this function, and uses a slightly more efficient internal encoding, but for more bespoke custom user types this function should be sufficient.
pp_value ty fmt vl
returns a pretty printer for values of a type ty
.