package caqti
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=1bf0c0d60547033c10d6148cf5297b25ab66c9a2832b680329df2f3816bc674d
sha512=0b03bd1788d99bbac59679338768a5633ec473346eed333fca4c104bc88f04c24e138af2228fc20dcf295b7106778328d228643ae8235a3f722f54cc69919295
doc/caqti/Caqti_response_sig/module-type-S/index.html
Module type Caqti_response_sig.S
The type describing the response and containing returned data from a request execution.
'bis the type of a single row'mis the possible multiplicities of rows
Result inspection
val returned_count :
('b, 'm) t ->
(int, [> Caqti_error.retrieve | `Unsupported ]) result futurereturned_count resp is the number of rows returned by resp. This function may not be available for all databases.
val affected_count :
('b, 'm) t ->
(int, [> Caqti_error.retrieve ]) result futureaffected_count resp is the number of rows affected by the updated the produced resp.
Result retrieval
val exec :
(unit, [< `Zero ]) t ->
(unit, [> Caqti_error.retrieve ]) result futureexec resp checks that resp succeeded with no result rows.
val find : ('b, [< `One ]) t -> ('b, [> Caqti_error.retrieve ]) result futurefind resp checks that resp succeeded with a single row, and returns the decoded row.
val find_opt :
('b, [< `Zero | `One ]) t ->
('b option, [> Caqti_error.retrieve ]) result futurefind_opt resp checks that resp succeeded with at most one row, and returns the row if any.
val fold :
('b -> 'c -> 'c) ->
('b, 'm) t ->
'c ->
('c, [> Caqti_error.retrieve ]) result futurefold f resp folds f over the decoded rows returned in resp.
val fold_s :
('b -> 'c -> ('c, 'e) result future) ->
('b, 'm) t ->
'c ->
('c, [> Caqti_error.retrieve ] as 'e) result futurefold_s f resp folds f over the decoded rows returned by resp within the IO and result monad.
Note. Do not make nested queries in the callback to this function. If you use the same connection, it may lead to data corruption. If you pull a different connection from the same pool, it may deadlock if the pool runs out of connections. Also, some drivers may not support simpltaneous connections.
val iter_s :
('b -> (unit, 'e) result future) ->
('b, 'm) t ->
(unit, [> Caqti_error.retrieve ] as 'e) result futureiter_s f resp iterates f over the decoded rows returned by resp within the IO and result monad.
Note. Do not make nested queries in the callback to this function. Cf. fold_s.
val to_stream : ('b, 'm) t -> ('b, [> Caqti_error.retrieve ] as 'err) streamto_stream resp returns a stream whose elements are the decoded rows returned by resp.