package caqti
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=4c84a16d983d0fed2786f536a3fa4d8fa113b8b30b4deea4a74772582d5489b2
md5=42a2e2d3b73d7fbaecc618549aad2865
doc/caqti/Caqti_type/index.html
Module Caqti_type
Source
Type descriptors for fields and tuples.
Primitive Field Types
The following is normally only needed for drivers and to define new field types. Everything needed for common usage is covered in Row Types.
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.
Row Types
type _ t = private
Type descriptor for row types.
Note. The concrete representation of this type should be considered private, including pattern-matching usage; use the below functions for compatibility with future versions.
pp ppf t
prints a human presentation of t
on ppf
.
pp_ex ppf t
prints a human presentation of t
on ppf
.
Composite
A holding no fields. This is used to pass no parameters and as the result for queries which does not return any rows. It can also be nested in tuples, in which case it will not contribute to the total number of fields.
val custom :
encode:('a -> ('b, string) result) ->
decode:('b -> ('a, string) result) ->
'b t ->
'a t
custom ~encode ~decode rep
creates a custom type represented by rep
, where encode
is used to encode parameters into rep
and decode
is used to decode result rows from rep
.
Note. This should be considered experimental and may be revised or removed in a future version.
Singular
field ft
is a row of a single field of type ft
. This function can be used when adding new field types; use the below functions otherwise.
An UTF-8 string. The database should accept UTF-8 if non-ASCII characters are present.