cake/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
- 🪶SQLite does not support
ANY,ALLandSIMILAR TO.
Types
pub type WhereValue =
read_query.WhereValue
Functions
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 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: ReadQuery,
) -> 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: ReadQuery,
) -> 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: ReadQuery) -> Where
Creates a WHERE clause that checks if it exists in a sub-query.
pub fn false() -> WhereValue
Creates a FALSE WhereValue.
Notice: You probably want to use where.is_false() instead.
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: ReadQuery,
) -> 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: ReadQuery,
) -> 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: ReadQuery,
) -> 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: ReadQuery,
) -> 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 in_query(
value vl: WhereValue,
sub_query qry: ReadQuery,
) -> Where
Creates a WHERE clause that checks if a WhereValue is IN a sub-query.
NOTICE: Usually the sub-query must return a single column.
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: ReadQuery,
) -> 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: ReadQuery,
) -> 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: ReadQuery,
) -> 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: ReadQuery,
) -> 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 similar_to(
value vl: WhereValue,
to pttrn: String,
escape_with escp_char: String,
) -> Where
Creates a WHERE clause that checks if a WhereValue is similar to a
pattern.
NOTICE: Not supported by 🪶SQLite.
pub fn sub_query(query qry: ReadQuery) -> WhereValue
Creates a WhereValue off a ReadQuery.
NOTICE: Usually the sub-query must return a single column.
pub fn true() -> WhereValue
Creates a TRUE WhereValue.
Notice: You probably want to use where.is_true() instead.