Rel.Col
Column descriptions.
This module defines a type to describe columns. A column is defined by its name, its type, an optional default value and how to project it from the row representation it belongs to.
The type for extensible column parameters. Warning this may be removed in the future.
The type for a column with values represented by type 'a
and which are part of a row represented by type 'r
.
The type for a column value for a row of type 'r
.
val v :
?params:'a param list ->
?default:'a default ->
string ->
'a Type.t ->
('r -> 'a) ->
('r, 'a) t
v ?default name t proj
is a column named name
with type t
, row projection function proj
and default default
(defaults to None
).
val proj : ('r, 'a) t -> 'r -> 'a
proj c
is the projection function of c
.
equal_name c0 c1
is true
if c0
and c1
have the same name.
val pp : Stdlib.Format.formatter -> ('r, 'a) t -> unit
pp
formats column descriptions.
val pp_name : Stdlib.Format.formatter -> ('r, 'a) t -> unit
pp_name
formats the column name.
val value_pp : ('r, 'a) t -> Stdlib.Format.formatter -> 'r -> unit
value_pp
formats a row's column value.
val pp_value : Stdlib.Format.formatter -> 'r value -> unit
pp_value ppf v
formats v
's value.