cake/combined

A DSL to build combined queries, such as:

Compatibility

Types

pub type Combined =
  @internal Combined
pub type Comment =
  @internal Comment

Defines the direction of an OrderBy.

pub type Direction {
  Asc
  Desc
}

Constructors

  • Asc
  • Desc
pub type Epilog =
  @internal Epilog
pub type Limit =
  @internal Limit
pub type Offset =
  @internal Offset
pub type OrderBy =
  @internal OrderBy
pub type OrderByDirection =
  @internal OrderByDirection
pub type ReadQuery =
  @internal ReadQuery
pub type Select =
  @internal Select

Values

pub fn comment(
  query qry: @internal Combined,
  comment cmmnt: String,
) -> @internal Combined

Appends a Comment to the Combined read_query.

pub fn epilog(
  query qry: @internal Combined,
  epilog eplg: String,
) -> @internal Combined

Appends an Epilog to the Combined read_query.

pub fn except(
  query_a qry_a: @internal Select,
  query_b qry_b: @internal Select,
) -> @internal Combined

Creates an EXCEPT query out of two queries as a Combined ReadQuery.

pub fn except_all(
  query_a qry_a: @internal Select,
  query_b qry_b: @internal Select,
) -> @internal Combined

Creates an EXCEPT ALL query out of two queries as a Combined ReadQuery.

NOTICE: Not supported by 🪶SQLite.

pub fn excepts(
  query_a qry_a: @internal Select,
  query_b qry_b: @internal Select,
  more_queries mr_qrys: List(@internal Select),
) -> @internal Combined

Creates an EXCEPT query out of two or more queries as a Combined ReadQuery.

pub fn excepts_all(
  query_a qry_a: @internal Select,
  query_b qry_b: @internal Select,
  more_queries mr_qrys: List(@internal Select),
) -> @internal Combined

Creates an EXCEPT ALL query out of two or more queries as a Combined ReadQuery.

NOTICE: Not supported by 🪶SQLite.

pub fn get_comment(
  query qry: @internal Combined,
) -> @internal Comment

Gets the Comment from the Combined read_query.

pub fn get_epilog(
  query qry: @internal Combined,
) -> @internal Epilog

Gets the Epilog from the Combined read_query.

pub fn get_limit(
  query qry: @internal Combined,
) -> @internal Limit

Gets Limit in the Combined ReadQuery.

pub fn get_offset(
  query qry: @internal Combined,
) -> @internal Offset

Gets Offset in the Combined ReadQuery.

pub fn get_order_by(
  query qry: @internal Combined,
) -> @internal OrderBy

Gets the OrderBy from the Combined read_query.

pub fn get_queries(
  combined cmbnd: @internal Combined,
) -> List(@internal Select)

Gets the queries from a Combined ReadQuery.

pub fn intersect(
  query_a qry_a: @internal Select,
  query_b qry_b: @internal Select,
) -> @internal Combined

Creates an INTERSECT query out of two queries as a Combined ReadQuery.

pub fn intersect_all(
  query_a qry_a: @internal Select,
  query_b qry_b: @internal Select,
) -> @internal Combined

Creates an INTERSECT ALL query out of two queries as a Combined ReadQuery.

NOTICE: Not supported by 🪶SQLite.

pub fn intersects(
  query_a qry_a: @internal Select,
  query_b qry_b: @internal Select,
  more_queries mr_qrys: List(@internal Select),
) -> @internal Combined

Creates an INTERSECT query out of two or more queries as a Combined read_query.

pub fn intersects_all(
  query_a qry_a: @internal Select,
  query_b qry_b: @internal Select,
  more_queries mr_qrys: List(@internal Select),
) -> @internal Combined

Creates an INTERSECT ALL query out of two or more queries as a Combined ReadQuery.

NOTICE: Not supported by 🪶SQLite.

pub fn limit(
  query qry: @internal Combined,
  limit lmt: Int,
) -> @internal Combined

Sets a Limit in the Combined ReadQuery.

pub fn no_comment(
  query qry: @internal Combined,
) -> @internal Combined

Removes the Comment from the Combined read_query.

pub fn no_epilog(
  query qry: @internal Combined,
) -> @internal Combined

Removes the Epilog from the Combined read_query.

pub fn no_limit(
  query qry: @internal Combined,
) -> @internal Combined

Removes Limit from the Combined ReadQuery.

pub fn no_offset(
  query qry: @internal Combined,
) -> @internal Combined

Removes Offset from the Combined ReadQuery.

pub fn no_order_by(
  query qry: @internal Combined,
) -> @internal Combined

Removes the OrderBy from the Combined read_query.

pub fn offset(
  query qry: @internal Combined,
  offest offst: Int,
) -> @internal Combined

Sets an Offset in the Combined ReadQuery.

pub fn order_by(
  query qry: @internal Combined,
  by ordb: String,
  direction dir: Direction,
) -> @internal Combined

Creates or appends an OrderBy a column with a direction.

The direction can either ASC or DESC.

pub fn order_by_asc(
  query qry: @internal Combined,
  by ordb: String,
) -> @internal Combined

Creates or appends an ascending OrderBy.

pub fn order_by_asc_nulls_first(
  query qry: @internal Combined,
  by ordb: String,
) -> @internal Combined

Creates or appends an ascending OrderBy with NULLS FIRST.

NOTICE: 🦭MariaDB and 🐬MySQL do not support NULLS FIRST out of the box.

pub fn order_by_asc_nulls_last(
  query qry: @internal Combined,
  by ordb: String,
) -> @internal Combined

Creates or appends an ascending OrderBy with NULLS LAST.

NOTICE: 🦭MariaDB and 🐬MySQL do not support NULLS LAST out of the box.

pub fn order_by_desc(
  query qry: @internal Combined,
  by ordb: String,
) -> @internal Combined

Creates or appends a descending OrderBy.

pub fn order_by_desc_nulls_first(
  query qry: @internal Combined,
  by ordb: String,
) -> @internal Combined

Creates or appends a descending order with NULLS FIRST.

NOTICE: 🦭MariaDB and 🐬MySQL do not support NULLS FIRST out of the box.

pub fn order_by_desc_nulls_last(
  query qry: @internal Combined,
  by ordb: String,
) -> @internal Combined

Creates or appends a descending OrderBy with NULLS LAST.

NOTICE: 🦭MariaDB and 🐬MySQL do not support NULLS LAST out of the box.

pub fn replace_order_by(
  query qry: @internal Combined,
  by ordb: String,
  direction dir: Direction,
) -> @internal Combined

Replaces the OrderBy a column with a direction.

pub fn replace_order_by_asc(
  query qry: @internal Combined,
  by ordb: String,
) -> @internal Combined

Replaces the OrderBy a single ascending OrderBy.

pub fn replace_order_by_asc_nulls_first(
  query qry: @internal Combined,
  by ordb: String,
) -> @internal Combined

Replaces the OrderBy a single ascending OrderBy with NULLS FIRST.

NOTICE: 🦭MariaDB and 🐬MySQL do not support NULLS FIRST out of the box.

pub fn replace_order_by_asc_nulls_last(
  query qry: @internal Combined,
  by ordb: String,
) -> @internal Combined

Replaces the OrderBy a single ascending OrderBy with NULLS LAST.

NOTICE: 🦭MariaDB and 🐬MySQL do not support NULLS LAST out of the box.

pub fn replace_order_by_desc(
  query qry: @internal Combined,
  by ordb: String,
) -> @internal Combined

Replaces the OrderBy a single descending order.

pub fn replace_order_by_desc_nulls_first(
  query qry: @internal Combined,
  by ordb: String,
) -> @internal Combined

Replaces the OrderBy a single descending order with NULLS FIRST.

NOTICE: 🦭MariaDB and 🐬MySQL do not support NULLS FIRST out of the box.

pub fn replace_order_by_desc_nulls_last(
  query qry: @internal Combined,
  by ordb: String,
) -> @internal Combined

Replaces the OrderBy a single descending OrderBy with NULLS LAST.

NOTICE: 🦭MariaDB and 🐬MySQL do not support NULLS LAST out of the box.

pub fn to_query(
  combined cmbnd: @internal Combined,
) -> @internal ReadQuery

Creates a ReadQuery from a Combined read_query.

pub fn union(
  query_a qry_a: @internal Select,
  query_b qry_b: @internal Select,
) -> @internal Combined

Creates a UNION query out of two queries as a Combined ReadQuery.

pub fn union_all(
  query_a qry_a: @internal Select,
  query_b qry_b: @internal Select,
) -> @internal Combined

Creates a UNION ALL query out of two queries as a Combined ReadQuery.

pub fn unions(
  query_a qry_a: @internal Select,
  query_b qry_b: @internal Select,
  more_queries mr_qrys: List(@internal Select),
) -> @internal Combined

Creates a UNION query out of two or more queries as a Combined ReadQuery.

pub fn unions_all(
  query_a qry_a: @internal Select,
  query_b qry_b: @internal Select,
  more_queries mr_qrys: List(@internal Select),
) -> @internal Combined

Creates a UNION ALL query out of two or more queries as a Combined ReadQuery.

NOTICE: Not supported by 🪶SQLite.

Search Document