cake/query/where

Used to build WHERE clauses for SQL queries.

Where clauses are used to filter rows in a table.

Also used to build HAVING clauses for SQL queries, because they work the same way as WHERE clauses, but are used to filter rows after GROUP BY has been applied.

Compatibility

Functions

pub fn and(wheres whrs: List(Where)) -> Where

Logical AND of multiple Wheres.

pub fn between(
  value_a vl_a: WhereValue,
  value_b vl_b: WhereValue,
  value_c vl_c: WhereValue,
) -> Where

Creates a WHERE clause that checks if a WhereValue A is between two WhereValues B and C.

pub fn col(name: String) -> WhereValue

Creates a WhereValue from a column name String.

pub fn eq(
  value_a vl_a: WhereValue,
  value_b vl_b: WhereValue,
) -> Where

Creates a WHERE clause that checks if a WhereValue equals another WhereValue.

pub fn eq_all_query(
  value vl: WhereValue,
  sub_query qry: Query,
) -> Where

Creates a WHERE clause that checks if a WhereValue matches all in a sub-query.

NOTICE: Not supported by SQLite.

pub fn eq_any_query(
  value vl: WhereValue,
  sub_query qry: Query,
) -> Where

Creates a WHERE clause that checks if a WhereValue matches any in a sub-query.

NOTICE: Not supported by SQLite.

pub fn exists_in_query(sub_query qry: Query) -> Where

Creates a WHERE clause that checks if it exists in a sub-query.

pub fn float(v vl: Float) -> WhereValue

Creates a WhereValue from a Float.

pub fn fragment(fragment frgmt: Fragment) -> Where

Creates a WhereFragment from a Fragment.

pub fn fragment_value(fragment frgmt: Fragment) -> WhereValue

Creates a WhereValue from a Fragment.

pub fn gt(
  value_a vl_a: WhereValue,
  value_b vl_b: WhereValue,
) -> Where

Creates a WHERE clause that checks if a WhereValue is greater than another WhereValue.

pub fn gt_all_query(
  value vl: WhereValue,
  sub_query qry: Query,
) -> Where

Creates a WHERE clause that checks if a WhereValue is greater than all in a sub-query.

NOTICE: Not supported by SQLite.

pub fn gt_any_query(
  value vl: WhereValue,
  sub_query qry: Query,
) -> Where

Creates a WHERE clause that checks if a WhereValue is greater than any in a sub-query.

NOTICE: Not supported by SQLite.

pub fn gte(
  value_a vl_a: WhereValue,
  value_b vl_b: WhereValue,
) -> Where

Creates a WHERE clause that checks if a WhereValue is greater or equal to another WhereValue.

pub fn gte_all_query(
  value vl: WhereValue,
  sub_query qry: Query,
) -> Where

Creates a WHERE clause that checks if a WhereValue is greater or equal to all in a sub-query.

NOTICE: Not supported by SQLite.

pub fn gte_any_query(
  value vl: WhereValue,
  sub_query qry: Query,
) -> Where

Creates a WHERE clause that checks if a WhereValue is greater or equal to any in a sub-query.

NOTICE: Not supported by SQLite.

pub fn ilike(
  value vl: WhereValue,
  pattern pttrn: String,
) -> Where

Creates a WHERE clause that checks if a WhereValue matches a pattern.

ilike is the same as like but case-insensitive.

pub fn in(
  value vl: WhereValue,
  values vals: List(WhereValue),
) -> Where

Creates a WHERE clause that checks if a WhereValue is in a list of WhereValues.

pub fn int(v vl: Int) -> WhereValue

Creates a WhereValue from an Int.

pub fn is_bool(value vl: WhereValue, bool b: Bool) -> Where

Creates a WHERE clause that checks if a WhereValue matches a Bool.

pub fn is_false(value vl: WhereValue) -> Where

Creates a WHERE clause that checks if a WhereValue is False.

pub fn is_not_bool(value vl: WhereValue, bool b: Bool) -> Where

Creates a WHERE clause that checks if a WhereValue does not match a Bool.

pub fn is_not_null(value vl: WhereValue) -> Where

Creates a WHERE clause that checks if a WhereValue is not SQL NULL.

pub fn is_null(value vl: WhereValue) -> Where

Creates a WHERE clause that checks if a WhereValue is SQL NULL.

pub fn is_true(value vl: WhereValue) -> Where

Creates a WHERE clause that checks if a WhereValue is True.

pub fn like(value vl: WhereValue, pattern pttrn: String) -> Where

Creates a WHERE clause that checks if a WhereValue matches a pattern. The pattern can contain for example the following wildcards:

  • % matches any sequence of characters.
  • _ matches any single character.
pub fn lt(
  value_a vl_a: WhereValue,
  value_b vl_b: WhereValue,
) -> Where

Creates a WHERE clause that checks if a WhereValue lower than another WhereValue.

pub fn lt_all_query(
  value vl: WhereValue,
  sub_query qry: Query,
) -> Where

Creates a WHERE clause that checks if a WhereValue is lower than all in a sub-query.

NOTICE: Not supported by SQLite.

pub fn lt_any_query(
  value vl: WhereValue,
  sub_query qry: Query,
) -> Where

Creates a WHERE clause that checks if a WhereValue is lower than an any in a sub-query.

NOTICE: Not supported by SQLite.

pub fn lte(
  value_a vl_a: WhereValue,
  value_b vl_b: WhereValue,
) -> Where

Creates a WHERE clause that checks if a WhereValue lower or equal to another WhereValue.

pub fn lte_all_query(
  value vl: WhereValue,
  sub_query qry: Query,
) -> Where

Creates a WHERE clause that checks if a WhereValue is lower or equal to all in a sub-query.

NOTICE: Not supported by SQLite.

pub fn lte_any_query(
  value vl: WhereValue,
  sub_query qry: Query,
) -> Where

Creates a WHERE clause that checks if a WhereValue is lower or equal to any in a sub-query.

NOTICE: Not supported by SQLite.

pub fn not(where whr: Where) -> Where

Negates a Where.

pub fn null() -> WhereValue

Creates a NULL WhereValue.

pub fn or(wheres whrs: List(Where)) -> Where

Logical OR of multiple Wheres.

pub fn similar_to(
  value vl: WhereValue,
  to pttrn: String,
) -> Where

Creates a WHERE clause that checks if a WhereValue is similar to a pattern.

NOTICE: Not supported by SQLite.

pub fn string(v vl: String) -> WhereValue

Creates a WhereValue from a String.

pub fn xor(wheres whrs: List(Where)) -> Where

Logical XOR of multiple Wheres.

Search Document