package sqlite3_utils

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Values representing types to pass to a statement, or to extract from a row

type ('a, 'res) t

A representation of a type that returns 'res. 'a is typically a function type with the arguments one would expect, for example (int -> string -> 'res, 'res) t would be used for a query that is parametrized by two values of type int and string respectively.

type 'a arg
val int : int arg
val int64 : int64 arg
val float : float arg
val text : string arg
val blob : string arg
val any_str : string arg
val data : Data.t arg
val nullable : 'a arg -> 'a option arg

Accepts Data.t.NULL and Data.t.NONE or 'a.

  • since 0.3
val nil : ('res, 'res) t

0 type arguments

val (@>) : 'a arg -> ('b, 'res) t -> ('a -> 'b, 'res) t

Right-associative chaining. int @> float @> nil represents two arguments of type int and float respectively, and is the same as int @> (float @> nil).

val p1 : 'a arg -> ('a -> 'res, 'res) t

Exactly one argument of type 'a

val p2 : 'a arg -> 'b arg -> ('a -> 'b -> 'res, 'res) t

Exactly two arguments of types 'a and 'b respectively.

val p3 : 'a arg -> 'b arg -> 'c arg -> ('a -> 'b -> 'c -> 'res, 'res) t
val p4 : 'a arg -> 'b arg -> 'c arg -> 'd arg -> ('a -> 'b -> 'c -> 'd -> 'res, 'res) t
val p5 : 'a arg -> 'b arg -> 'c arg -> 'd arg -> 'e arg -> ('a -> 'b -> 'c -> 'd -> 'e -> 'res, 'res) t
val p6 : 'a arg -> 'b arg -> 'c arg -> 'd arg -> 'e arg -> 'f arg -> ('a -> 'b -> 'c -> 'd -> 'e -> 'f -> 'res, 'res) t
val (@>>) : ('a, 'b) t -> ('b, 'res) t -> ('a, 'res) t

Right-associative append. This is useful for long lists of types. (p2 int float) @>> (p1 text) is the same as p3 int float text, which is the same as int @> float @> text @> nil.

val id : 'a -> 'a

Empty list of arguments

val mkp2 : 'a -> 'b -> 'a * 'b

Make a tuple. Useful in, for example, Ty.( p2 int text, mkp2).

val mkp3 : 'a -> 'b -> 'c -> 'a * 'b * 'c
val mkp4 : 'a -> 'b -> 'c -> 'd -> 'a * 'b * 'c * 'd
val mkp5 : 'a -> 'b -> 'c -> 'd -> 'e -> 'a * 'b * 'c * 'd * 'e
val mkp6 : 'a -> 'b -> 'c -> 'd -> 'e -> 'f -> 'a * 'b * 'c * 'd * 'e * 'f
OCaml

Innovation. Community. Security.