cake/query/combined

A DSL to build combined queries, such as:

Compatibility

Types

Defines the direction of an OrderBy.

pub type Direction {
  Asc
  Desc
}

Constructors

  • Asc
  • Desc

Functions

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

Appends a Comment to the Combined query.

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

Appends an Epilog to the Combined query.

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

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

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

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

NOTICE: Not supported by SQLite.

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

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

NOTICE: Not supported by SQLite.

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

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

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

Gets the Comment from the Combined query.

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

Gets the Epilog from the Combined query.

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

Gets Limit in the Combined query.

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

Gets Offset in the Combined query.

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

Gets the OrderBy from the Combined query.

pub fn get_queries(combined_query qry: Combined) -> List(Select)

Gets the queries from a Combined query.

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

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

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

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

NOTICE: Not supported by SQLite.

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

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

NOTICE: Not supported by SQLite.

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

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

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

Sets a Limit in the Combined query.

pub fn no_comment(query qry: Combined) -> Combined

Removes the Comment from the Combined query.

pub fn no_epilog(query qry: Combined) -> Combined

Removes the Epilog from the Combined query.

pub fn no_limit(query qry: Combined) -> Combined

Removes Limit from the Combined query.

pub fn no_offset(query qry: Combined) -> Combined

Removes Offset from the Combined query.

pub fn no_order_by(query qry: Combined) -> Combined

Removes the OrderBy from the Combined query.

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

Sets an Offset in the Combined query.

pub fn order_by(
  query qry: Combined,
  by ordb: String,
  direction dir: Direction,
) -> 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: Combined,
  by ordb: String,
) -> Combined

Creates or appends an ascending OrderBy.

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

Creates or appends an ascending OrderBy with NULLS FIRST.

NOTICE: MariaDB/MySQL do not support NULLS FIRST out of the box.

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

Creates or appends an ascending OrderBy with NULLS LAST.

NOTICE: MariaDB/MySQL do not support NULLS LAST out of the box.

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

Creates or appends a descending OrderBy.

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

Creates or appends a descending order with NULLS FIRST.

NOTICE: MariaDB/MySQL do not support NULLS FIRST out of the box.

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

Creates or appends a descending OrderBy with NULLS LAST.

NOTICE: MariaDB/MySQL do not support NULLS LAST out of the box.

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

Replaces the OrderBy a column with a direction.

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

Replaces the OrderBy a single ascending OrderBy.

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

Replaces the OrderBy a single ascending OrderBy with NULLS FIRST.

NOTICE: MariaDB/MySQL do not support NULLS FIRST out of the box.

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

Replaces the OrderBy a single ascending OrderBy with NULLS LAST.

NOTICE: MariaDB/MySQL do not support NULLS LAST out of the box.

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

Replaces the OrderBy a single descending order.

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

Replaces the OrderBy a single descending order with NULLS FIRST.

NOTICE: MariaDB/MySQL do not support NULLS FIRST out of the box.

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

Replaces the OrderBy a single descending OrderBy with NULLS LAST.

NOTICE: MariaDB/MySQL do not support NULLS LAST out of the box.

pub fn to_query(combined_query qry: Combined) -> Query

Creates a Query from a Combined query.

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

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

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

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

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

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

NOTICE: Not supported by SQLite.

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

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

Search Document