Module Rel.Row

Row descriptions.

A row describe rows of table or query results. It is a cartesian product of columns and an OCaml constructor for injecting rows into OCaml values.


type ('r, 'a) prod

The type for constructing a cartesian product whose final result is represented by OCaml values of type 'r.

type 'r t = ( 'r, 'r ) prod

The type for a row represented by OCaml values of type 'r.

val unit : 'a -> ( 'r, 'a ) prod

unit f is a (virtual) unit column with constructor f to be saturated by prod.

val prod : ( 'r, 'a -> 'b ) prod -> ( 'r, 'a ) Col.t -> ( 'r, 'b ) prod

prod r c is the product of columns r with c.

val (*) : ( 'r, 'a -> 'b ) prod -> ( 'r, 'a ) Col.t -> ( 'r, 'b ) prod

* is

val cat : ( 'r, 'a -> 'b ) prod -> proj:( 'r -> 'a ) -> 'a t -> ( 'r, 'b ) prod

cat r ~proj row is the product of columns r with the columns of row, proj is used to project row values from the result of r.

val empty : unit t

empty is the empty product unit (). A row specification for side effecting SQL statements, (e.g. UPDATE).

module Quick : sig ... end

Quick row specification syntax for query results.


val fold : ( 'a -> 'r Col.v -> 'a ) -> 'a -> ( 'r, 'b ) prod -> 'a

fold f acc r folds over the columns of f from right-to-left.


val cols : ( 'r, 'a ) prod -> 'r Col.v list

cols r are the columns in row r, from left-to-right, untyped.

val col_count : ( 'r, 'a ) prod -> int

col_count r is the number of columns in row r.


val pp_header : Stdlib.Format.formatter -> 'r t -> unit

pp_header formats the column names of the row.

val value_pp : 'r t -> Stdlib.Format.formatter -> 'r -> unit

value_pp r formats values of r.

val list_pp : ?header:bool -> 'r t -> Stdlib.Format.formatter -> 'r list -> unit

list_pp formats list of values of r, one per line. If header is true, starts by formatting the headers of r.