Rel.Type
Column types.
This module defines a type whose values describes the type of columns and how they are represented in OCaml.
The type for type 'a
encoded as type 'b
, see Coded
.
The type for the type of columns. The type 'a
is the type used to represent the column values in OCaml. Warning the open type may be closed in the future.
type t +=
Type of columns supported by all database management systems. Note that these are NOT NULL
columns unless you use Option
.
val pp : Stdlib.Format.formatter -> 'a t -> unit
pp ppf t
formats an unspecified representation of t
on ppf
. Raises Invalid_argument
if t
is unknown to the module.
module Coded : sig ... end
Coded types.
val is_option : 'a t -> bool
is_option t
is true
iff t
is an option type, that is a column that allows NULLs.
equal t0 t1
is true
iff t0
and t1
have the underlying type. For Coded
values this check equality of Coded.repr
. Warning this returns false
on unknown types.
val value_equal : 'a t -> 'a -> 'a -> bool
value_equal t v0 v1
is true
iff v0
and v1
of type t
are equal. Note that for now this is simply ( = )
but we may add a notion of equality to coded
at some point.
val value_pp : 'a t -> Stdlib.Format.formatter -> 'a -> unit
value_pp t
is a formatter for values of type t
. Raises Invalid_argument
if t
is unknown to the module.
Since the type is extensible and larger than it should be these functions can be used for failing in functions that process type values.
invalid_unknown ()
raises Invalid_argument
indicating that the type is unknown.