package pgx_async

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type s
val sexp_of_s : s -> Sexplib0.Sexp.t
val prepare : ?name:string -> ?types:int32 list -> t -> query:string -> s Io.t

prepare ?name ?types conn ~query prepares the statement query and sets the parameter types to types. If no name is given, a random name will be generated. If no types are given, then the PostgreSQL engine infers types.

val close : s -> unit Io.t

close_statement t closes a prepared statement and frees up any resources.

val with_prepare : ?name:string -> ?types:int32 list -> t -> query:string -> f:(s -> 'a Io.t) -> 'a Io.t

prepare a query, execute f, and then close_statement

val execute : ?portal:string -> s -> params:Pgx__.Pgx_value.v option list -> Pgx__.Pgx_value.v option list list Io.t

execute conn ~params t executes the given prepared statement, with the given parameters params, returning the result rows (if any).

There are several steps involved at the protocol layer: (1) a "portal" is created from the statement, binding the parameters in the statement (Bind). (2) the portal is executed (Execute). (3) we synchronise the connection (Sync).

The optional ?portal parameter may be used to name the portal created in step (1) above (otherwise the unnamed portal is used). This is only important if you want to call describe_portal to find out the result types.

val execute_unit : ?portal:string -> s -> params:Pgx__.Pgx_value.v option list -> unit Io.t

execute_unit ?portal s ?params same as execute, but intended for database calls that have side-affects rather than returning results

val execute_fold : ?portal:string -> s -> params:Pgx__.Pgx_value.v option list -> init:'accum -> f:('accum -> Pgx__.Pgx_value.v option list -> 'accum Io.t) -> 'accum Io.t
val execute_iter : ?portal:string -> s -> params:Pgx__.Pgx_value.v option list -> f:(Pgx__.Pgx_value.v option list -> unit Io.t) -> unit Io.t
val execute_map : ?portal:string -> s -> params:Pgx__.Pgx_value.v option list -> f:(Pgx__.Pgx_value.v option list -> 'a Io.t) -> 'a list Io.t
val execute_many : s -> params:Pgx__.Pgx_value.v option list list -> Pgx__.Pgx_value.v option list list list Io.t
val describe : s -> (int32 list * Pgx.Result_desc.t list option) Io.t

describe_statement t describes the statement's parameter types and result types.

val close_portal : ?portal:string -> s -> unit Io.t

close_portal conn ?portal () closes a portal and frees up any resources.

val describe_portal : ?portal:string -> s -> Pgx.Result_desc.t list option Io.t

describe_portal conn ?portal () describes the named or unnamed portal's result types.

OCaml

Innovation. Community. Security.