⚠️ Oops! This page doesn't appear to define a type called _.

SqlComposer

other items defined

module Delete

SqlComposer.Delete

Generate composable SQL Delete queries and query fragments.

Here is a basic example:

let sql =
  SqlComposer.Delete.(
    make()
    |. from("test")
    |. where("AND test.foo = ?")
    |. toSql
  );
Js.log2("SQL: ", sql);
[@@@ocaml.ppx.context { cookies = [] }]
open SqlComposer
let sql =
  let open SqlComposer.Delete in
    (((make ()) |. (from (("test")[@reason.raw_literal "test"]))) |.
       (where (("AND test.foo = ?")[@reason.raw_literal "AND test.foo = ?"])))
      |. toSql
let _ = Js.log2 (("SQL: ")[@reason.raw_literal "SQL: "]) sql

other items defined

type t

let make: unit => t

let modifier: (t, [ `Quick | `LowPriority | `Ignore ]) => t

let from: (t, string) => t

let where: (t, string) => t

let orderBy: (t, [ `Asc of string | `Desc of string ]) => t

let limit: (t, ~?offset: option(int), ~row_count: int) => t

let toSql: t => string

module Select

SqlComposer.Select

Generate composable SQL Select queries and query fragments.

Here is a basic example:

let sql =
  SqlComposer.Select.(
    make()
    |. field("*")
    |. from("test")
    |. where("AND test.foo = ?")
    |. toSql
  );
Js.log2("SQL: ", sql);
[@@@ocaml.ppx.context { cookies = [] }]
open SqlComposer
let sql =
  let open SqlComposer.Select in
    ((((make ()) |. (field (("*")[@reason.raw_literal "*"]))) |.
        (from (("test")[@reason.raw_literal "test"])))
       |.
       (where (("AND test.foo = ?")[@reason.raw_literal "AND test.foo = ?"])))
      |. toSql
let _ = Js.log2 (("SQL: ")[@reason.raw_literal "SQL: "]) sql

other items defined

type t

let make: unit => t

let modifier: ( t, [ `MySqlCalcFoundRows | `MySqlNoCache | `HighPriority | `Distinct | `StraightJoin ] ) => t

let field: (t, string) => t

let from: (t, string) => t

let join: (t, string) => t

let where: (t, string) => t

let groupBy: (t, string) => t

let orderBy: (t, [ `Asc of string | `Desc of string ]) => t

let limit: (t, ~?offset: option(int), ~row_count: int) => t

let toSql: t => string

module Update

SqlComposer.Update

Generate composable SQL Update statements and fragments.

Here is a basic example:

let sql =
  SqlComposer.Update.(
    make()
    |. from("test")
    |. set("foo", "?")
    |. set("bar", "?")
    |. where({|AND moo = "cow"|})
    |. toSql
  );
Js.log2("SQL: ", sql);
[@@@ocaml.ppx.context { cookies = [] }]
open SqlComposer
let sql =
  let open SqlComposer.Update in
    (((((make ()) |. (from (("test")[@reason.raw_literal "test"]))) |.
         (set (("foo")[@reason.raw_literal "foo"])
            (("?")[@reason.raw_literal "?"])))
        |.
        (set (("bar")[@reason.raw_literal "bar"])
           (("?")[@reason.raw_literal "?"])))
       |. (where {|AND moo = "cow"|}))
      |. toSql
let _ = Js.log2 (("SQL: ")[@reason.raw_literal "SQL: "]) sql

other items defined

type t

let make: unit => t

let modifier: (t, [ `LowPriority | `Ignore ]) => t

let from: (t, string) => t

let join: (t, string) => t

let set: (t, string, string) => t

let where: (t, string) => t

let orderBy: (t, [ `Asc of string | `Desc of string ]) => t

let limit: (t, ~?offset: option(int), ~row_count: int) => t

let toSql: t => string

module Conversion

This module does not have a toplevel documentation block.