Module Ask.Col

Column descriptions.

Columns are tupled into rows. A column is defined by its name, its type and how to project it from an OCaml value representing a row.

TODO.

Columns

type param = ..

The type for extensible column parameters. See Parameters.

FIXME. Add columns parameters like we did for Table.param. For now it oddly breaks compilation.

type ('r, 'a) t = {
name : string;
params : param list;
type' : 'a Type.t;
proj : 'r -> 'a;
}

The type for a column of type 'a which is part of a row stored in an OCaml value of type 'r. Unless you get into recursive trouble use constructor v.

type 'r v =
| V : ('r'a) t -> 'r v

The type for existential columns for a row of type 'r.

type 'r value =
| Value : ('r'a) t * 'a -> 'r value

The type for a column value for a row of type 'r.

val v : ?params:param list -> string -> 'a Type.t -> ('r -> 'a) -> ('r'a) t

v name t proj ~params is a column named name with type t, row projection function proj and parameters params (defaults to []).

val name : ('r'a) t -> string

name c is the name of c.

val params : ('r'a) t -> param list

params c are the parameters of c.

val type' : ('r'a) t -> 'a Type.t

type' is the type of c.

val proj : ('r'a) t -> 'r -> 'a

proj c is the projection function of c.

val no_proj : 'r -> 'a

no_proj raises Invalid_argument.

Predicates

val equal_name : ('r'a) t -> ('s'b) t -> bool

equal_name c0 c1 is true if c0 and c1 have the same name.

Parameters

See Ask.Sql for more parameters.

Formatters

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.

val pp_sep : Stdlib.Format.formatter -> unit -> unit

pp_sep formats a separator for columns.