cake/query/delete

A DSL to build DELETE queries.

Functions

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

Specify a comment for the Delete query.

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

Specify an epilog for the Delete query.

pub fn get_comment(query qry: Delete(a)) -> Comment

Get the comment from an Delete query.

pub fn get_epilog(query qry: Delete(a)) -> Epilog

Get the epilog from an Delete query.

pub fn get_modifier(query qry: Delete(a)) -> String

Gets the DELETE modifier.

pub fn get_table(query qry: Delete(a)) -> String

Gets the table name of the Delete query.

pub fn get_using(query qry: Delete(a)) -> List(From)

Gets the USING clause of the Delete query.

pub fn get_where(query qry: Delete(a)) -> Where

Gets the Where of the Delete query.

pub fn modifier(
  query qry: Delete(a),
  modifier mdfr: String,
) -> Delete(a)

Sets the DELETE modifier.

pub fn new(table_name tbl_nm: String) -> Delete(a)

Creates an empty Delete query.

pub fn no_comment(query qry: Delete(a)) -> Delete(a)

Specify that no comment should be added to the Delete query.

pub fn no_epilog(query qry: Delete(a)) -> Delete(a)

Specify that no epilog should be added to the Delete query.

pub fn no_modifier(query qry: Delete(a)) -> Delete(a)

Removes the DELETE modifier.

pub fn no_returning(query qry: Delete(a)) -> Delete(a)

Specify that no columns should be returned after the Delete query.

pub fn no_using(query qry: Delete(a)) -> Delete(a)

Removes the USING clause from the Delete query.

pub fn no_where(query qry: Delete(a)) -> Delete(a)

Removes the Where from the Delete query.

pub fn or_where(
  query qry: Delete(a),
  where whr: Where,
) -> Delete(a)

Sets an OrWhere or appends into an existing OrWhere.

  • If the outermost Where is an OrWhere, the new Where is appended to the list within OrWhere.
  • If the query does not have a Where clause, the given Where is set instead.
  • If the outermost Where is any other kind of Where, this and the current outermost Where are wrapped in an OrWhere.
pub fn replace_using_sub_query(
  query qry: Delete(a),
  sub_query sb_qry: Query,
  alias als: String,
) -> Delete(a)

Replaces the USING clause of the Delete query with a sub-query.

pub fn replace_using_table(
  query qry: Delete(a),
  table tbl: String,
) -> Delete(a)

Replaces the USING clause of the Delete query with a table.

pub fn replace_where(
  query qry: Delete(a),
  where whr: Where,
) -> Delete(a)

Replaces the Where in the Delete query.

pub fn returning(
  query qry: Delete(a),
  returning rtrn: List(String),
) -> Delete(a)

Specify the columns to return after the Delete query.

pub fn table(
  query qry: Delete(a),
  table_name tbl_nm: String,
) -> 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: Delete(a)) -> WriteQuery(a)

Creates a WriteQuery from a Delete query.

pub fn using_sub_query(
  query qry: Delete(a),
  sub_query sb_qry: Query,
  alias als: String,
) -> 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.

pub fn using_table(
  query qry: Delete(a),
  table tbl: String,
) -> 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.

pub fn where(query qry: Delete(a), where whr: Where) -> Delete(a)

Sets an AndWhere or appends into an existing AndWhere.

  • If the outermost Where is an AndWhere, the new Where is appended to the list within AndWhere.
  • If the query does not have a Where clause, the given Where is set instead.
  • If the outermost Where is any other kind of Where, this and the current outermost Where are wrapped in an AndWhere.
pub fn xor_where(
  query qry: Delete(a),
  where whr: Where,
) -> Delete(a)

Sets an XorWhere or appends into an existing XorWhere.

  • If the outermost Where is an XorWhere, the new Where is appended to the list within XorWhere.
  • If the query does not have a Where clause, the given Where is set instead.
  • If the outermost Where is any other kind of Where, this and the current outermost Where are wrapped in an XorWhere.

NOTICE: This operator does not exist in Postgres or SQLite, and Cake generates equivalent SQL using OR and AND and NOT. This operator exists in MariaDB/MySQL.

Search Document