package caqti

  1. Overview
  2. Docs

Facilities for extending and using primitive field types.

type 'a t = ..

An extensible type describing primitive SQL types and types which can be converted to and from such types. When adding a new constructor, register the coding with Field.define_coding if possible. Otherwise, the type will only work with drivers which handle it themselves. The shipped drivers only handle the constructors listed here.

type _ coding =
  1. | Coding : {
    1. rep : 'b t;
    2. encode : 'a -> ('b, string) Stdlib.result;
    3. decode : 'b -> ('a, string) Stdlib.result;
    } -> 'a coding
type get_coding = {
  1. get_coding : 'a. Caqti_driver_info.t -> 'a t -> 'a coding;
}
val define_coding : 'a t -> get_coding -> unit
val coding : Caqti_driver_info.t -> 'a t -> 'a coding option
val to_string : 'a t -> string