package caqti

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

Internal request-related utilities.

Queries

val linear_param_length : ?env:(string -> Caqti_query.t) -> Caqti_query.t -> int

linear_param_length templ is the number of linear parameters expected by a query represented by templ.

val linear_param_order : ?env:(string -> Caqti_query.t) -> Caqti_query.t -> int list list * (int * string) list

linear_param_order templ describes the parameter bindings expected for templ after linearizing parameters and lifting quoted strings out of the query:

  • The first is a list where item number i is a list of linear parameter positions to which to bind the ith incoming parameter.
  • The second is a list of pairs where the first component is the position of the linear parameter taking the place of a quoted string, and the second component is the quoted string to bind to this parameter.

All positions are zero-based.

val linear_query_string : ?env:(string -> Caqti_query.t) -> Caqti_query.t -> string

linear_query_string templ is templ where "?" is substituted for parameters and quoted strings.

Parameter Encoding and Row Decoding

val raise_encode_missing : uri:Uri.t -> field_type:'a Caqti_type.Field.t -> unit -> 'counit
val raise_encode_rejected : uri:Uri.t -> typ:'a Caqti_type.t -> Caqti_error.msg -> 'counit
val raise_encode_failed : uri:Uri.t -> typ:'a Caqti_type.t -> Caqti_error.msg -> 'counit
val raise_decode_missing : uri:Uri.t -> field_type:'a Caqti_type.Field.t -> unit -> 'counit
val raise_decode_rejected : uri:Uri.t -> typ:'a Caqti_type.t -> Caqti_error.msg -> 'counit
val raise_response_failed : uri:Uri.t -> query:string -> Caqti_error.msg -> 'counit
val raise_response_rejected : uri:Uri.t -> query:string -> Caqti_error.msg -> 'counit
type 'a field_encoder = {
  1. write_value : 'b. uri:Uri.t -> 'b Caqti_type.Field.t -> 'b -> 'a -> 'a;
  2. write_null : 'b. uri:Uri.t -> 'b Caqti_type.Field.t -> 'a -> 'a;
} constraint 'e = [> `Encode_rejected of Caqti_error.coding_error ]
val encode_param : uri:Uri.t -> 'a field_encoder -> 'b Caqti_type.t -> 'b -> 'a -> 'a
type 'a field_decoder = {
  1. read_value : 'b. uri:Uri.t -> 'b Caqti_type.Field.t -> 'a -> 'b * 'a;
  2. skip_null : int -> 'a -> 'a option;
} constraint 'e = [> `Decode_rejected of Caqti_error.coding_error ]
val decode_row : uri:Uri.t -> 'a field_decoder -> 'b Caqti_type.t -> 'a -> 'b * 'a
OCaml

Innovation. Community. Security.