Sqlite.Request
Module for creating SQL requests with metadata for tracing and debugging. This is a wrapper around Caqti's request system with additional metadata.
Type of a SQL request with input type 'a
, output type 'b
, and multiplicity 'm
. The multiplicity indicates how many rows the request is expected to return:
`Zero
: No rows`One
: Exactly one row`Many
: Zero or more rowsval (->.) :
'a Caqti_type.t ->
unit Caqti_type.t ->
?name:string ->
?table:string ->
?attrs:('a -> Opentelemetry.key_value list) ->
?oneshot:bool ->
string ->
('a, unit, [ `Zero ]) t
a ->. unit
creates a request that takes input of type a
and returns no rows. Useful for INSERT, UPDATE, DELETE operations.
val (->!) :
'a Caqti_type.t ->
'b Caqti_type.t ->
?name:string ->
?table:string ->
?attrs:('a -> Opentelemetry.key_value list) ->
?oneshot:bool ->
string ->
('a, 'b, [ `One ]) t
a ->! b
creates a request that takes input of type a
and returns exactly one row of type b
. Useful for SELECT queries that must return exactly one result.
val (->?) :
'a Caqti_type.t ->
'b Caqti_type.t ->
?name:string ->
?table:string ->
?attrs:('a -> Opentelemetry.key_value list) ->
?oneshot:bool ->
string ->
('a, 'b, [ `One | `Zero ]) t
a ->? b
creates a request that takes input of type a
and returns zero or one row of type b
. Useful for SELECT queries that may not find a result.
val (->*) :
'a Caqti_type.t ->
'b Caqti_type.t ->
?name:string ->
?table:string ->
?attrs:('a -> Opentelemetry.key_value list) ->
?oneshot:bool ->
string ->
('a, 'b, [ `Many | `One | `Zero ]) t
a ->* b
creates a request that takes input of type a
and returns any number of rows of type b
. Useful for SELECT queries that return multiple results.