package caqti

  1. Overview
  2. Docs

Module Caqti_type.StdSource

Standard type descriptors provided as a submodule for easy inclusion.

Composite

The following provides constructors for narrow tuple types; to describe wider tuple types, use nested application.

Sourceval option : 'a t -> 'a option t
Sourceval unit : unit t

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.

Sourceval tup2 : 'a t -> 'b t -> ('a * 'b) t

Creates a pair type.

Sourceval tup3 : 'a t -> 'b t -> 'c t -> ('a * 'b * 'c) t

Creates a 3-tuple type.

Sourceval tup4 : 'a t -> 'b t -> 'c t -> 'd t -> ('a * 'b * 'c * 'd) t

Creates a 4-tuple type.

Sourceval 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

Sourceval bool : bool t

A boolean.

Sourceval int : int t

An integer.

Sourceval int32 : int32 t

A 32 bit integer.

Sourceval int64 : int64 t

A 64 bit integer.

Sourceval float : float t

A float.

Sourceval string : string t

An UTF-8 string. The database should accept UTF-8 if non-ASCII characters are present.

Sourceval octets : string t

A binary string.

Sourceval pdate : Ptime.t t

A date. This corresponds to the SQL date type.

Sourceval ptime : Ptime.t t

An absolute time with driver-dependent precision. This corresponds to an SQL timestamp type with UTC time zone.

Sourceval ptime_span : Ptime.span t

A period of time. If the database lacks a dedicated representation, the integer number of seconds is used.

OCaml

Innovation. Community. Security.