package petrol

  1. Overview
  2. Docs
type table_name

Uniquely identifies a table in the system.

module Type : sig ... end

Defines all supported SQL types.

module Expr : sig ... end

Provides an SQL E-DSL for writing well-typed SQL expressions.

module Schema : sig ... end

Provides an E-DSL for specifying SQL tables in OCaml.

module Query : sig ... end

Provides an E-DSL for specifying SQL queries in OCaml.

module Request : sig ... end

This module defines a request type t that can be executed by Caqti (see exec, find, find_opt). The functions defined in this module cache their inputs, so it is safe to call these repeatedly.

module StaticSchema : sig ... end

Provides a helper interface, primarily for prototyping/debugging, that declares a static table without any versioning.

module VersionedSchema : sig ... end

Provides an interface that declares a versioned schema.

val exec : (module Caqti_lwt.CONNECTION) -> (unit, [< `Zero ]) Request.t -> (unit, [> Caqti_error.call_or_retrieve ]) Stdlib.result Lwt.t

exec db req executes a unit SQL request req on the SQL database db.

val find : (module Caqti_lwt.CONNECTION) -> ('a, [< `One ]) Request.t -> ('a, [> Caqti_error.call_or_retrieve ]) Stdlib.result Lwt.t

find db req executes a singleton SQL request req on the SQL database db returning the result.

val find_opt : (module Caqti_lwt.CONNECTION) -> ('a, [< `One | `Zero ]) Request.t -> ('a option, [> Caqti_error.call_or_retrieve ]) Stdlib.result Lwt.t

find_opt db req executes a zero-or-one SQL request req on the SQL database db returning the result if it exists.

val collect_list : (module Caqti_lwt.CONNECTION) -> ('a, [< `Many | `One | `Zero ]) Request.t -> ('a list, [> Caqti_error.call_or_retrieve ]) Stdlib.result Lwt.t

collect_list db req executes a SQL request req on the SQL database db and collects the results into a list.

OCaml

Innovation. Community. Security.