Module Petrol.Type

type 'a t

Represents an SQL data type that maps to an OCaml type 'a.

val pp : Stdlib.Format.formatter -> 'a t -> unit
val show : 'a t -> string
val custom : ty:'a Caqti_type.t -> repr:string -> 'a t

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.

val pp_value : 'a t -> Stdlib.Format.formatter -> 'a -> unit

pp_value ty fmt vl returns a pretty printer for values of a type ty.

module Numeric : sig ... end

Poor man's type classes for numeric arguments.