cake/delete
A DSL to build DELETE queries.
Types
pub type DeleteTable =
@internal DeleteTable
pub type DeleteUsing =
@internal DeleteUsing
pub type WriteQuery(a) =
@internal WriteQuery(a)
Values
pub fn comment(
delete dlt: @internal Delete(a),
comment cmmnt: String,
) -> @internal Delete(a)
Specify a comment for the Delete query.
pub fn epilog(
delete dlt: @internal Delete(a),
epilog eplg: String,
) -> @internal Delete(a)
Specify an epilog for the Delete query.
pub fn get_comment(
delete dlt: @internal Delete(a),
) -> @internal Comment
Get the comment from an Delete query.
pub fn get_epilog(
delete dlt: @internal Delete(a),
) -> @internal Epilog
Get the epilog from an Delete query.
pub fn get_joins(
delete dlt: @internal Delete(a),
) -> @internal Joins
Gets the Joins of the Delete query.
pub fn get_modifier(delete dlt: @internal Delete(a)) -> String
Gets the DELETE modifier.
pub fn get_table(
delete dlt: @internal Delete(a),
) -> @internal DeleteTable
Gets the table name of the Delete query.
pub fn get_using(
delete dlt: @internal Delete(a),
) -> List(@internal From)
Gets the USING clause of the Delete query.
pub fn get_where(
delete dlt: @internal Delete(a),
) -> @internal Where
Gets the Where of the Delete query.
pub fn join(
delete dlt: @internal Delete(a),
join jn: @internal Join,
) -> @internal Delete(a)
Adds a Join to the Delete query.
NOTICE: On 🐘PostgreSQL and 🪶SQLite Joins are only allowed if the FROM
clause is set as well.
pub fn joins(
delete dlt: @internal Delete(a),
joins jns: List(@internal Join),
) -> @internal Delete(a)
Adds Joins to the Delete query.
NOTICE: On 🐘PostgreSQL and 🪶SQLite Joins are only allowed if the FROM
clause is set as well.
pub fn modifier(
delete dlt: @internal Delete(a),
modifier mdfr: String,
) -> @internal Delete(a)
Sets the DELETE modifier.
pub fn no_comment(
delete dlt: @internal Delete(a),
) -> @internal Delete(a)
Specify that no comment should be added to the Delete query.
pub fn no_epilog(
delete dlt: @internal Delete(a),
) -> @internal Delete(a)
Specify that no epilog should be added to the Delete query.
pub fn no_join(
delete dlt: @internal Delete(a),
) -> @internal Delete(a)
Removes any Joins from the Delete query.
pub fn no_modifier(
delete dlt: @internal Delete(a),
) -> @internal Delete(a)
Removes the DELETE modifier.
pub fn no_returning(
delete dlt: @internal Delete(a),
) -> @internal Delete(a)
Specify that no columns should be returned after the Delete query.
pub fn no_table(
delete dlt: @internal Delete(a),
) -> @internal Delete(a)
Removes the table name from the Delete query.
pub fn no_using(
delete dlt: @internal Delete(a),
) -> @internal Delete(a)
Removes the USING clause from the Delete query.
pub fn no_where(
delete dlt: @internal Delete(a),
) -> @internal Delete(a)
Removes the Where from the Delete query.
pub fn or_where(
delete dlt: @internal Delete(a),
where whr: @internal Where,
) -> @internal Delete(a)
Sets an OrWhere or appends into an existing OrWhere.
- If the outermost
Whereis anOrWhere, the newWhereis appended to the list withinOrWhere. - If the query does not have a
Whereclause, the givenWhereis set instead. - If the outermost
Whereis any other kind ofWhere, this and the current outermostWhereare wrapped in anOrWhere.
pub fn replace_join(
delete dlt: @internal Delete(a),
join jn: @internal Join,
) -> @internal Delete(a)
Replaces any Joins of the Delete query with a signle Join.
NOTICE: On 🐘PostgreSQL and 🪶SQLite Joins are only allowed if the FROM
clause is set as well.
pub fn replace_joins(
delete dlt: @internal Delete(a),
joins jns: List(@internal Join),
) -> @internal Delete(a)
Replaces any Joins of the Delete query with the given Joins.
NOTICE: On 🐘PostgreSQL and 🪶SQLite Joins are only allowed if the FROM
clause is set as well.
pub fn replace_using_sub_query(
delete dlt: @internal Delete(a),
query qry: @internal ReadQuery,
alias als: String,
) -> @internal Delete(a)
Replaces the USING clause of the Delete query with a sub-query.
pub fn replace_using_table(
delete dlt: @internal Delete(a),
table_name tbl_nm: String,
) -> @internal Delete(a)
Replaces the USING clause of the Delete query with a table.
pub fn replace_where(
delete dlt: @internal Delete(a),
where whr: @internal Where,
) -> @internal Delete(a)
Replaces the Where in the Delete query.
pub fn returning(
delete dlt: @internal Delete(a),
returning rtrn: List(String),
) -> @internal Delete(a)
Specify the columns to return after the Delete query.
pub fn table(
delete dlt: @internal Delete(a),
table_name tbl_nm: String,
) -> @internal Delete(a)
Sets the table name of the Delete query, aka the table where
the rows will be deleted from.
pub fn to_query(
delete dlt: @internal Delete(a),
) -> @internal WriteQuery(a)
Creates a WriteQuery from a Delete query.
pub fn using_sub_query(
delete dlt: @internal Delete(a),
query qry: @internal ReadQuery,
alias als: String,
) -> @internal Delete(a)
Adds a USING clause to the Delete query specifing a sub-query.
The sub-query must be aliased.
If the query already has a USING clause, the new USING clause
will be appended to the existing one.
The USING clause is used to specify additional tables that are used
to filter the rows to be deleted.
NOTICE: 🪶SQLite does not support USING.
NOTICE: 🦭MariaDB and 🐬MySQL may not support sub-queries in the USING
clause.
In such case you may use a sub-query in a WHERE clause, or use a join
instead.
pub fn using_table(
delete dlt: @internal Delete(a),
table_name tbl_nm: String,
) -> @internal Delete(a)
Adds a USING clause to the Delete query specifing a table.
If the query already has a USING clause, the new USING clause
will be appended to the existing one.
The USING clause is used to specify additional tables that are used
to filter the rows to be deleted.
NOTICE: 🪶SQLite does not support USING.
NOTICE: For 🦭MariaDB and 🐬MySQL it is mandatory to specify the table set
within the FROM clause in the USING clause, again - e.g. in raw SQL:
DELETE * FROM a USING a, b, WHERE a.b_id = b.id;
pub fn where(
delete dlt: @internal Delete(a),
where whr: @internal Where,
) -> @internal Delete(a)
Sets an AndWhere or appends into an existing AndWhere.
- If the outermost
Whereis anAndWhere, the newWhereis appended to the list withinAndWhere. - If the query does not have a
Whereclause, the givenWhereis set instead. - If the outermost
Whereis any other kind ofWhere, this and the current outermostWhereare wrapped in anAndWhere.
pub fn xor_where(
delete dlt: @internal Delete(a),
where whr: @internal Where,
) -> @internal Delete(a)
Sets an XorWhere or appends into an existing XorWhere.
- If the outermost
Whereis anXorWhere, the newWhereis appended to the list withinXorWhere. - If the query does not have a
Whereclause, the givenWhereis set instead. - If the outermost
Whereis any other kind ofWhere, this and the current outermostWhereare wrapped in anXorWhere.
NOTICE: This operator does not exist in 🐘PostgreSQL or 🪶SQLite, and
Cake generates equivalent SQL using OR and AND and NOT.
NOTICE: This operator exists in 🦭MariaDB and 🐬MySQL, nativly.