package petrol

  1. Overview
  2. Docs
type table_name

Uniquely identifies a table in the system.

module Expr : sig ... end

Defines an extensible embedding of SQL expressions.

module Type : sig ... end
type ('ret_ty, 'query_kind) query

('ret_ty, 'query_tag) query represents an SQL query that returns values of type 'ret_ty and is a SQL query of kind 'query_kind -- see Petrol.Query.t.

type ('res, 'multiplicity) request

Represents a compiled SQL database request.

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 Sqlite3 : sig ... end
module Postgres : sig ... end
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 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 -> (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 -> ('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 -> ('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 -> ('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.