package caqti
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=d688bd22f6fde5be5a755900545fade0d5fdce6dbcb0b85770d02dad87c41e7c
md5=d18745a703da336054c0d27e78f8be8a
doc/caqti.v1/Caqti1_sigs/module-type-CONNECTION/index.html
Module type Caqti1_sigs.CONNECTION
Source
The main API as provided after connecting to a resource.
The IO monad for which the module is specialized.
The URI used to connect to the database.
Information about the database driver which provides this connection.
Calling disconnect ()
closes the connection to the database and frees up related resources.
For internal use by Caqti_pool
. Tries to ensure the validity of the connection and must return false
if unsuccessful.
For internal use by Caqti_pool
. Called after a connection has been used. check f
must call f ()
exactly once with an argument indicating whether to keep the connection in the pool or discard it.
Returns a description of parameters and returned tuples. What is returned may be limited by what the underlying library supports. The number of paratemers and tuple components should be correct, but the types may be `Unknown
.
Querying
exec q params
executes a query q(params)
which is not expected to return anything.
find_e q params
executes q(params)
which is expected to return exactly one tuple.
find q params
executes a query q(params)
which is expected to return at most one tuple.
fold q f params acc
executes q(params)
, composes f
over the resulting tuples in order, and applies the composition to acc
.
fold_s q f params acc
executes q(params)
, forms a threaded composition of f
over the resulting tuples, and applies the composition to acc
.
fold_p q f params
executes q(params)
and calls f t
in the thread monad in parallel for each resulting tuple t
. A certain backend may not implement parallel execution, in which case this is the same as iter_s
.
fold_s q f params
executes q(params)
and calls f t
sequentially in the thread monad for each resulting tuple t
in order.
Transactions
Starts a transaction if supported by the underlying database, otherwise does nothing.
Commits the current transaction if supported by the underlying database, otherwise does nothing.