UpdateStatement

Struct UpdateStatement 

pub struct UpdateStatement { /* private fields */ }
Expand description

Update existing rows in the table

§Examples

use sea_query::{tests_cfg::*, *};

let query = Query::update()
    .table(Glyph::Table)
    .values([(Glyph::Aspect, 1.23.into()), (Glyph::Image, "123".into())])
    .and_where(Expr::col(Glyph::Id).eq(1))
    .to_owned();

assert_eq!(
    query.to_string(MsSqlQueryBuilder),
    r#"UPDATE [glyph] SET [aspect] = 1.23, [image] = '123' WHERE [id] = 1"#
);
assert_eq!(
    query.to_string(MysqlQueryBuilder),
    r#"UPDATE `glyph` SET `aspect` = 1.23, `image` = '123' WHERE `id` = 1"#
);
assert_eq!(
    query.to_string(PostgresQueryBuilder),
    r#"UPDATE "glyph" SET "aspect" = 1.23, "image" = '123' WHERE "id" = 1"#
);
assert_eq!(
    query.to_string(SqliteQueryBuilder),
    r#"UPDATE "glyph" SET "aspect" = 1.23, "image" = '123' WHERE "id" = 1"#
);

Implementations§

§

impl UpdateStatement

pub fn new() -> Self

Construct a new UpdateStatement

pub fn take(&mut self) -> Self

pub fn table<T>(&mut self, tbl_ref: T) -> &mut Self
where T: IntoTableRef,

Specify which table to update.

§Examples

See UpdateStatement::values

pub fn from<R>(&mut self, tbl_ref: R) -> &mut Self
where R: IntoTableRef,

Update using data from another table (UPDATE .. FROM ..).

§MySQL Notes

MySQL doesn’t support the UPDATE FROM syntax. And the current implementation attempt to tranform it to the UPDATE JOIN syntax, which only works for one join target.

§Examples
use sea_query::{audit::*, tests_cfg::*, *};

let query = Query::update()
    .table(Glyph::Table)
    .value(Glyph::Tokens, Expr::column((Char::Table, Char::Character)))
    .from(Char::Table)
    .cond_where(
        Expr::col((Glyph::Table, Glyph::Image))
            .eq(Expr::col((Char::Table, Char::UserData))),
    )
    .to_owned();

assert_eq!(
    query.to_string(MysqlQueryBuilder),
    "UPDATE `glyph` JOIN `character` ON `glyph`.`image` = `character`.`user_data` SET `glyph`.`tokens` = `character`.`character`"
);
assert_eq!(
    query.to_string(PostgresQueryBuilder),
    r#"UPDATE "glyph" SET "tokens" = "character"."character" FROM "character" WHERE "glyph"."image" = "character"."user_data""#
);
assert_eq!(
    query.to_string(SqliteQueryBuilder),
    r#"UPDATE "glyph" SET "tokens" = "character"."character" FROM "character" WHERE "glyph"."image" = "character"."user_data""#
);
assert_eq!(
    query.audit().unwrap().updated_tables(),
    [Glyph::Table.into_iden()]
);
assert_eq!(
    query.audit().unwrap().selected_tables(),
    [Char::Table.into_iden()]
);

pub fn values<T, I>(&mut self, values: I) -> &mut Self
where T: IntoIden, I: IntoIterator<Item = (T, Expr)>,

Update column values. To set multiple column-value pairs at once.

§Examples
use sea_query::{audit::*, tests_cfg::*, *};

let query = Query::update()
    .table(Glyph::Table)
    .values([
        (Glyph::Aspect, 2.1345.into()),
        (Glyph::Image, "235m".into()),
    ])
    .to_owned();

assert_eq!(
    query.to_string(MsSqlQueryBuilder),
    r#"UPDATE [glyph] SET [aspect] = 2.1345, [image] = '235m'"#
);
assert_eq!(
    query.to_string(MysqlQueryBuilder),
    r#"UPDATE `glyph` SET `aspect` = 2.1345, `image` = '235m'"#
);
assert_eq!(
    query.to_string(PostgresQueryBuilder),
    r#"UPDATE "glyph" SET "aspect" = 2.1345, "image" = '235m'"#
);
assert_eq!(
    query.to_string(SqliteQueryBuilder),
    r#"UPDATE "glyph" SET "aspect" = 2.1345, "image" = '235m'"#
);
assert_eq!(
    query.audit().unwrap().updated_tables(),
    [Glyph::Table.into_iden()]
);
assert_eq!(query.audit().unwrap().selected_tables(), []);

pub fn value<C, T>(&mut self, col: C, value: T) -> &mut Self
where C: IntoIden, T: Into<Expr>,

Update column value by Expr.

§Examples
use sea_query::{*, tests_cfg::*};

let query = Query::update()
    .table(Glyph::Table)
    .value(Glyph::Aspect, Expr::cust("60 * 24 * 24"))
    .values([
        (Glyph::Image, "24B0E11951B03B07F8300FD003983F03F0780060".into()),
    ])
    .to_owned();

assert_eq!(
    query.to_string(MsSqlQueryBuilder),
    r#"UPDATE [glyph] SET [aspect] = 60 * 24 * 24, [image] = '24B0E11951B03B07F8300FD003983F03F0780060'"#
);
assert_eq!(
    query.to_string(MysqlQueryBuilder),
    r#"UPDATE `glyph` SET `aspect` = 60 * 24 * 24, `image` = '24B0E11951B03B07F8300FD003983F03F0780060'"#
);
assert_eq!(
    query.to_string(PostgresQueryBuilder),
    r#"UPDATE "glyph" SET "aspect" = 60 * 24 * 24, "image" = '24B0E11951B03B07F8300FD003983F03F0780060'"#
);
assert_eq!(
    query.to_string(SqliteQueryBuilder),
    r#"UPDATE "glyph" SET "aspect" = 60 * 24 * 24, "image" = '24B0E11951B03B07F8300FD003983F03F0780060'"#
);

let query = Query::update()
    .table(Glyph::Table)
    .value(Glyph::Aspect, Expr::value(Value::Int(None)))
    .to_owned();

assert_eq!(
    query.to_string(MysqlQueryBuilder),
    r#"UPDATE `glyph` SET `aspect` = NULL"#
);
assert_eq!(
    query.to_string(PostgresQueryBuilder),
    r#"UPDATE "glyph" SET "aspect" = NULL"#
);
assert_eq!(
    query.to_string(SqliteQueryBuilder),
    r#"UPDATE "glyph" SET "aspect" = NULL"#
);

pub fn limit(&mut self, limit: u64) -> &mut Self

Limit number of updated rows.

pub fn returning(&mut self, returning: ReturningClause) -> &mut Self

RETURNING expressions.

§Examples
use sea_query::{audit::*, tests_cfg::*, *};

let query = Query::update()
    .table(Glyph::Table)
    .value(Glyph::Aspect, 2.1345)
    .value(Glyph::Image, "235m")
    .returning(Query::returning().columns([Glyph::Id]))
    .to_owned();

assert_eq!(
    query.to_string(MsSqlQueryBuilder),
    r#"UPDATE [glyph] SET [aspect] = 2.1345, [image] = '235m' OUTPUT [id]"#
);
assert_eq!(
    query.to_string(MysqlQueryBuilder),
    r#"UPDATE `glyph` SET `aspect` = 2.1345, `image` = '235m'"#
);
assert_eq!(
    query.to_string(PostgresQueryBuilder),
    r#"UPDATE "glyph" SET "aspect" = 2.1345, "image" = '235m' RETURNING "id""#
);
assert_eq!(
    query.to_string(SqliteQueryBuilder),
    r#"UPDATE "glyph" SET "aspect" = 2.1345, "image" = '235m' RETURNING "id""#
);
assert_eq!(
    query.audit().unwrap().updated_tables(),
    [Glyph::Table.into_iden()]
);
assert_eq!(
    query.audit().unwrap().selected_tables(),
    [Glyph::Table.into_iden()]
);

pub fn returning_col<C>(&mut self, col: C) -> &mut Self
where C: IntoColumnRef,

RETURNING expressions for a column.

§Examples
use sea_query::{tests_cfg::*, *};

let query = Query::update()
    .table(Glyph::Table)
    .table(Glyph::Table)
    .value(Glyph::Aspect, 2.1345)
    .value(Glyph::Image, "235m")
    .returning_col(Glyph::Id)
    .to_owned();

assert_eq!(
    query.to_string(MsSqlQueryBuilder),
    r#"UPDATE [glyph] SET [aspect] = 2.1345, [image] = '235m' OUTPUT [id]"#
);
assert_eq!(
    query.to_string(MysqlQueryBuilder),
    r#"UPDATE `glyph` SET `aspect` = 2.1345, `image` = '235m'"#
);
assert_eq!(
    query.to_string(PostgresQueryBuilder),
    r#"UPDATE "glyph" SET "aspect" = 2.1345, "image" = '235m' RETURNING "id""#
);
assert_eq!(
    query.to_string(SqliteQueryBuilder),
    r#"UPDATE "glyph" SET "aspect" = 2.1345, "image" = '235m' RETURNING "id""#
);

pub fn returning_all(&mut self) -> &mut Self

RETURNING expressions all columns.

§Examples
use sea_query::{tests_cfg::*, *};

let query = Query::update()
    .table(Glyph::Table)
    .table(Glyph::Table)
    .value(Glyph::Aspect, 2.1345)
    .value(Glyph::Image, "235m")
    .returning_all()
    .to_owned();

assert_eq!(
    query.to_string(MsSqlQueryBuilder),
    r#"UPDATE [glyph] SET [aspect] = 2.1345, [image] = '235m' OUTPUT *"#
);
assert_eq!(
    query.to_string(MysqlQueryBuilder),
    r#"UPDATE `glyph` SET `aspect` = 2.1345, `image` = '235m'"#
);
assert_eq!(
    query.to_string(PostgresQueryBuilder),
    r#"UPDATE "glyph" SET "aspect" = 2.1345, "image" = '235m' RETURNING *"#
);
assert_eq!(
    query.to_string(SqliteQueryBuilder),
    r#"UPDATE "glyph" SET "aspect" = 2.1345, "image" = '235m' RETURNING *"#
);

pub fn with(self, clause: WithClause) -> WithQuery

Create a WithQuery by specifying a WithClause to execute this query with.

§Examples
use sea_query::{IntoCondition, IntoIden, audit::*, tests_cfg::*, *};

let select = SelectStatement::new()
        .columns([Glyph::Id])
        .from(Glyph::Table)
        .and_where(Expr::col(Glyph::Image).like("0%"))
        .to_owned();
    let cte = CommonTableExpression::new()
        .query(select)
        .column(Glyph::Id)
        .table_name("cte")
        .to_owned();
    let with_clause = WithClause::new().cte(cte).to_owned();
    let update = UpdateStatement::new()
        .table(Glyph::Table)
        .and_where(Expr::col(Glyph::Id).in_subquery(SelectStatement::new().column(Glyph::Id).from("cte").to_owned()))
        .value(Glyph::Aspect, Expr::cust("60 * 24 * 24"))
        .to_owned();
    let query = update.with(with_clause);

assert_eq!(
    query.to_string(MsSqlQueryBuilder),
    r#"WITH [cte] ([id]) AS (SELECT [id] FROM [glyph] WHERE [image] LIKE '0%') UPDATE [glyph] SET [aspect] = 60 * 24 * 24 WHERE [id] IN (SELECT [id] FROM [cte])"#
);
assert_eq!(
    query.to_string(MysqlQueryBuilder),
    r#"WITH `cte` (`id`) AS (SELECT `id` FROM `glyph` WHERE `image` LIKE '0%') UPDATE `glyph` SET `aspect` = 60 * 24 * 24 WHERE `id` IN (SELECT `id` FROM `cte`)"#
);
assert_eq!(
    query.to_string(PostgresQueryBuilder),
    r#"WITH "cte" ("id") AS (SELECT "id" FROM "glyph" WHERE "image" LIKE '0%') UPDATE "glyph" SET "aspect" = 60 * 24 * 24 WHERE "id" IN (SELECT "id" FROM "cte")"#
);
assert_eq!(
    query.to_string(SqliteQueryBuilder),
    r#"WITH "cte" ("id") AS (SELECT "id" FROM "glyph" WHERE "image" LIKE '0%') UPDATE "glyph" SET "aspect" = 60 * 24 * 24 WHERE "id" IN (SELECT "id" FROM "cte")"#
);
assert_eq!(
    query.audit_unwrap().updated_tables(),
    [Glyph::Table.into_iden()]
);
assert_eq!(
    query.audit_unwrap().selected_tables(),
    [Glyph::Table.into_iden()]
);

pub fn with_cte<C: Into<WithClause>>(&mut self, clause: C) -> &mut Self

Create a Common Table Expression by specifying a CommonTableExpression or WithClause to execute this query with.

§Examples
use sea_query::{IntoCondition, IntoIden, audit::*, tests_cfg::*, *};

let select = SelectStatement::new()
        .columns([Glyph::Id])
        .from(Glyph::Table)
        .and_where(Expr::col(Glyph::Image).like("0%"))
        .to_owned();
    let cte = CommonTableExpression::new()
        .query(select)
        .column(Glyph::Id)
        .table_name("cte")
        .to_owned();
    let with_clause = WithClause::new().cte(cte).to_owned();
    let query = UpdateStatement::new()
        .table(Glyph::Table)
        .and_where(Expr::col(Glyph::Id).in_subquery(SelectStatement::new().column(Glyph::Id).from("cte").to_owned()))
        .value(Glyph::Aspect, Expr::cust("60 * 24 * 24"))
        .with_cte(with_clause)
        .to_owned();

assert_eq!(
    query.to_string(MysqlQueryBuilder),
    r#"WITH `cte` (`id`) AS (SELECT `id` FROM `glyph` WHERE `image` LIKE '0%') UPDATE `glyph` SET `aspect` = 60 * 24 * 24 WHERE `id` IN (SELECT `id` FROM `cte`)"#
);
assert_eq!(
    query.to_string(PostgresQueryBuilder),
    r#"WITH "cte" ("id") AS (SELECT "id" FROM "glyph" WHERE "image" LIKE '0%') UPDATE "glyph" SET "aspect" = 60 * 24 * 24 WHERE "id" IN (SELECT "id" FROM "cte")"#
);
assert_eq!(
    query.to_string(SqliteQueryBuilder),
    r#"WITH "cte" ("id") AS (SELECT "id" FROM "glyph" WHERE "image" LIKE '0%') UPDATE "glyph" SET "aspect" = 60 * 24 * 24 WHERE "id" IN (SELECT "id" FROM "cte")"#
);
assert_eq!(
    query.audit_unwrap().updated_tables(),
    [Glyph::Table.into_iden()]
);
assert_eq!(
    query.audit_unwrap().selected_tables(),
    [Glyph::Table.into_iden()]
);

pub fn get_values(&self) -> &[(DynIden, Box<Expr>)]

Get column values

§

impl UpdateStatement

pub fn build_collect_any_into( &self, query_builder: &impl QueryBuilder, sql: &mut impl SqlWriter, )

pub fn build_any(&self, query_builder: &impl QueryBuilder) -> (String, Values)

pub fn build_collect_any( &self, query_builder: &impl QueryBuilder, sql: &mut impl SqlWriter, ) -> String

§

impl UpdateStatement

pub fn build_collect_into<T: QueryBuilder>( &self, query_builder: T, sql: &mut impl SqlWriter, )

pub fn build_collect<T: QueryBuilder>( &self, query_builder: T, sql: &mut impl SqlWriter, ) -> String

pub fn build<T: QueryBuilder>(&self, query_builder: T) -> (String, Values)

pub fn to_string<T: QueryBuilder>(&self, query_builder: T) -> String

§

impl UpdateStatement

pub fn add_order_by(&mut self, order: OrderExpr) -> &mut Self

pub fn clear_order_by(&mut self) -> &mut Self

pub fn order_by<T>(&mut self, col: T, order: Order) -> &mut Self
where T: IntoColumnRef,

pub fn order_by_expr(&mut self, expr: Expr, order: Order) -> &mut Self

pub fn order_by_customs<I, T>(&mut self, cols: I) -> &mut Self
where T: Into<Cow<'static, str>>, I: IntoIterator<Item = (T, Order)>,

pub fn order_by_columns<I, T>(&mut self, cols: I) -> &mut Self
where T: IntoColumnRef, I: IntoIterator<Item = (T, Order)>,

pub fn order_by_with_nulls<T>( &mut self, col: T, order: Order, nulls: NullOrdering, ) -> &mut Self
where T: IntoColumnRef,

pub fn order_by_expr_with_nulls( &mut self, expr: Expr, order: Order, nulls: NullOrdering, ) -> &mut Self

pub fn order_by_customs_with_nulls<I, T>(&mut self, cols: I) -> &mut Self
where T: Into<Cow<'static, str>>, I: IntoIterator<Item = (T, Order, NullOrdering)>,

pub fn order_by_columns_with_nulls<I, T>(&mut self, cols: I) -> &mut Self
where T: IntoColumnRef, I: IntoIterator<Item = (T, Order, NullOrdering)>,

§

impl UpdateStatement

pub fn and_or_where(&mut self, condition: LogicalChainOper) -> &mut Self

pub fn cond_where<C>(&mut self, condition: C) -> &mut Self
where C: IntoCondition,

pub fn and_where_option(&mut self, other: Option<Expr>) -> &mut Self

pub fn and_where(&mut self, other: Expr) -> &mut Self

§

impl UpdateStatement

pub fn mut_table<F>(&mut self, f: F) -> &mut Self
where F: Fn(Option<&TableRef>) -> Option<TableRef>,

Trait Implementations§

§

impl Clone for UpdateStatement

§

fn clone(&self) -> UpdateStatement

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl ConditionalStatement for UpdateStatement

§

fn cond_where<C>(&mut self, condition: C) -> &mut Self
where C: IntoCondition,

Where condition, expressed with any and all. Calling cond_where multiple times will conjoin them. Calling or_where after cond_where will panic. Read more
§

fn and_where(&mut self, other: Expr) -> &mut Self

And where condition. Calling or_where after and_where will panic. Read more
§

fn and_where_option(&mut self, other: Option<Expr>) -> &mut Self

Optional and where, short hand for if c.is_some() q.and_where(c). Read more
§

impl Debug for UpdateStatement

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
§

impl Default for UpdateStatement

§

fn default() -> UpdateStatement

Returns the “default value” for a type. Read more
§

impl From<UpdateStatement> for Expr

§

fn from(v: UpdateStatement) -> Self

Converts to this type from the input type.
§

impl From<UpdateStatement> for QueryStatement

§

fn from(s: UpdateStatement) -> Self

Converts to this type from the input type.
§

impl From<UpdateStatement> for SubQueryStatement

§

fn from(s: UpdateStatement) -> Self

Converts to this type from the input type.
§

impl OrderedStatement for UpdateStatement

§

fn clear_order_by(&mut self) -> &mut Self

Clear order expressions
§

fn order_by<T>(&mut self, col: T, order: Order) -> &mut Self
where T: IntoColumnRef,

Order by column. Read more
§

fn order_by_expr(&mut self, expr: Expr, order: Order) -> &mut Self

Order by Expr.
§

fn order_by_customs<I, T>(&mut self, cols: I) -> &mut Self
where T: Into<Cow<'static, str>>, I: IntoIterator<Item = (T, Order)>,

Order by custom string.
§

fn order_by_columns<I, T>(&mut self, cols: I) -> &mut Self
where T: IntoColumnRef, I: IntoIterator<Item = (T, Order)>,

Order by vector of columns.
§

fn order_by_with_nulls<T>( &mut self, col: T, order: Order, nulls: NullOrdering, ) -> &mut Self
where T: IntoColumnRef,

Order by column with nulls order option. Read more
§

fn order_by_expr_with_nulls( &mut self, expr: Expr, order: Order, nulls: NullOrdering, ) -> &mut Self

Order by Expr with nulls order option.
§

fn order_by_customs_with_nulls<I, T>(&mut self, cols: I) -> &mut Self
where T: Into<Cow<'static, str>>, I: IntoIterator<Item = (T, Order, NullOrdering)>,

Order by custom string with nulls order option.
§

fn order_by_columns_with_nulls<I, T>(&mut self, cols: I) -> &mut Self
where T: IntoColumnRef, I: IntoIterator<Item = (T, Order, NullOrdering)>,

Order by vector of columns with nulls order option.
§

impl PartialEq for UpdateStatement

§

fn eq(&self, other: &UpdateStatement) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl QueryStatementBuilder for UpdateStatement

§

fn build_collect_any_into( &self, query_builder: &impl QueryBuilder, sql: &mut impl SqlWriter, )

Build corresponding SQL statement into the SqlWriter for certain database backend and collect query parameters
§

fn build_any(&self, query_builder: &impl QueryBuilder) -> (String, Values)

Build corresponding SQL statement for certain database backend and collect query parameters into a vector
§

fn build_collect_any( &self, query_builder: &impl QueryBuilder, sql: &mut impl SqlWriter, ) -> String

Build corresponding SQL statement for certain database backend and collect query parameters
§

fn into_sub_query_statement(self) -> SubQueryStatement

§

impl QueryStatementWriter for UpdateStatement

§

fn build_collect_into<T: QueryBuilder>( &self, query_builder: T, sql: &mut impl SqlWriter, )

§

fn to_string<T: QueryBuilder>(&self, query_builder: T) -> String

Build corresponding SQL statement for certain database backend and return SQL string Read more
§

fn build<T: QueryBuilder>(&self, query_builder: T) -> (String, Values)

Build corresponding SQL statement for certain database backend and collect query parameters into a vector Read more
§

fn build_collect<T: QueryBuilder>( &self, query_builder: T, sql: &mut impl SqlWriter, ) -> String

Build corresponding SQL statement for certain database backend and collect query parameters Read more
§

impl StructuralPartialEq for UpdateStatement

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> ExprTrait for T
where T: Into<Expr>,

§

fn as_enum<N>(self, type_name: N) -> Expr
where N: IntoIden,

Express a AS enum expression. Read more
§

fn binary<O, R>(self, op: O, right: R) -> Expr
where O: Into<BinOper>, R: Into<Expr>,

Create any binary operation Read more
§

fn cast_as<N>(self, type_name: N) -> Expr
where N: IntoIden,

Express a CAST AS expression. Read more
§

fn unary(self, op: UnOper) -> Expr

Apply any unary operator to the expression. Read more
§

fn max(self) -> Expr

Express a MAX function. Read more
§

fn min(self) -> Expr

Express a MIN function. Read more
§

fn sum(self) -> Expr

Express a SUM function. Read more
§

fn avg(self) -> Expr

Express a AVG (average) function. Read more
§

fn count(self) -> Expr

Express a COUNT function. Read more
§

fn count_distinct(self) -> Expr

Express a COUNT function with the DISTINCT modifier. Read more
§

fn if_null<V>(self, v: V) -> Expr
where V: Into<Expr>,

Express a IF NULL function. Read more
§

fn add<R>(self, right: R) -> Expr
where R: Into<Expr>,

Express an arithmetic addition operation. Read more
§

fn and<R>(self, right: R) -> Expr
where R: Into<Expr>,

Express a logical AND operation. Read more
§

fn between<A, B>(self, a: A, b: B) -> Expr
where A: Into<Expr>, B: Into<Expr>,

Express a BETWEEN expression. Read more
§

fn div<R>(self, right: R) -> Expr
where R: Into<Expr>,

Express an arithmetic division operation. Read more
§

fn eq<R>(self, right: R) -> Expr
where R: Into<Expr>,

Express an equal (=) expression. Read more
§

fn equals<C>(self, col: C) -> Expr
where C: IntoColumnRef,

Express a equal expression between two table columns, you will mainly use this to relate identical value between two table columns. Read more
§

fn gt<R>(self, right: R) -> Expr
where R: Into<Expr>,

Express a greater than (>) expression. Read more
§

fn gte<R>(self, right: R) -> Expr
where R: Into<Expr>,

Express a greater than or equal (>=) expression. Read more
§

fn in_subquery(self, sel: SelectStatement) -> Expr

Express a IN sub-query expression. Read more
§

fn in_tuples<V, I>(self, v: I) -> Expr
where V: IntoValueTuple, I: IntoIterator<Item = V>,

Express a IN sub expression. Read more
§

fn is<R>(self, right: R) -> Expr
where R: Into<Expr>,

Express a IS expression. Read more
§

fn is_in<V, I>(self, v: I) -> Expr
where V: Into<Expr>, I: IntoIterator<Item = V>,

Express a IN expression. Read more
§

fn is_not<R>(self, right: R) -> Expr
where R: Into<Expr>,

Express a IS NOT expression. Read more
§

fn is_not_in<V, I>(self, v: I) -> Expr
where V: Into<Expr>, I: IntoIterator<Item = V>,

Express a NOT IN expression. Read more
§

fn is_not_null(self) -> Expr

Express a IS NOT NULL expression. Read more
§

fn is_null(self) -> Expr

Express a IS NULL expression. Read more
§

fn left_shift<R>(self, right: R) -> Expr
where R: Into<Expr>,

Express a bitwise left shift. Read more
§

fn like<L>(self, like: L) -> Expr
where L: IntoLikeExpr,

Express a LIKE expression. Read more
§

fn lt<R>(self, right: R) -> Expr
where R: Into<Expr>,

Express a less than (<) expression. Read more
§

fn lte<R>(self, right: R) -> Expr
where R: Into<Expr>,

Express a less than or equal (<=) expression. Read more
§

fn modulo<R>(self, right: R) -> Expr
where R: Into<Expr>,

Express an arithmetic modulo operation. Read more
§

fn mul<R>(self, right: R) -> Expr
where R: Into<Expr>,

Express an arithmetic multiplication operation. Read more
§

fn ne<R>(self, right: R) -> Expr
where R: Into<Expr>,

Express a not equal (<>) expression. Read more
§

fn not(self) -> Expr

Negates an expression with NOT. Read more
§

fn not_between<A, B>(self, a: A, b: B) -> Expr
where A: Into<Expr>, B: Into<Expr>,

Express a NOT BETWEEN expression. Read more
§

fn not_equals<C>(self, col: C) -> Expr
where C: IntoColumnRef,

Express a not equal expression between two table columns, you will mainly use this to relate identical value between two table columns. Read more
§

fn not_in_subquery(self, sel: SelectStatement) -> Expr

Express a NOT IN sub-query expression. Read more
§

fn not_like<L>(self, like: L) -> Expr
where L: IntoLikeExpr,

Express a NOT LIKE expression. Read more
§

fn or<R>(self, right: R) -> Expr
where R: Into<Expr>,

Express a logical OR operation. Read more
§

fn right_shift<R>(self, right: R) -> Expr
where R: Into<Expr>,

Express a bitwise right shift. Read more
§

fn sub<R>(self, right: R) -> Expr
where R: Into<Expr>,

Express an arithmetic subtraction operation. Read more
§

fn bit_and<R>(self, right: R) -> Expr
where R: Into<Expr>,

Express a bitwise AND operation. Read more
§

fn bit_or<R>(self, right: R) -> Expr
where R: Into<Expr>,

Express a bitwise OR operation. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> PgExpr for T
where T: ExprTrait,

§

fn concatenate<T>(self, right: T) -> Expr
where T: Into<Expr>,

Express an postgres concatenate (||) expression. Read more
§

fn concat<T>(self, right: T) -> Expr
where T: Into<Expr>,

§

fn matches<T>(self, expr: T) -> Expr
where T: Into<Expr>,

Express an postgres fulltext search matches (@@) expression. Read more
§

fn contains<T>(self, expr: T) -> Expr
where T: Into<Expr>,

Express an postgres fulltext search contains (@>) expression. Read more
§

fn contained<T>(self, expr: T) -> Expr
where T: Into<Expr>,

Express an postgres fulltext search contained (<@) expression. Read more
§

fn ilike<L>(self, like: L) -> Expr
where L: IntoLikeExpr,

Express a ILIKE expression. Read more
§

fn not_ilike<L>(self, like: L) -> Expr
where L: IntoLikeExpr,

Express a NOT ILIKE expression
§

fn get_json_field<T>(self, right: T) -> Expr
where T: Into<Expr>,

Express a postgres retrieves JSON field as JSON value (->). Read more
§

fn cast_json_field<T>(self, right: T) -> Expr
where T: Into<Expr>,

Express a postgres retrieves JSON field and casts it to an appropriate SQL type (->>). Read more
§

impl<T> SqliteExpr for T
where T: ExprTrait,

§

fn glob<T>(self, right: T) -> Expr
where T: Into<Expr>,

Express an sqlite GLOB operator. Read more
§

fn matches<T>(self, right: T) -> Expr
where T: Into<Expr>,

Express an sqlite MATCH operator. Read more
§

fn get_json_field<T>(self, right: T) -> Expr
where T: Into<Expr>,

Express an sqlite retrieves JSON field as JSON value (->). Read more
§

fn cast_json_field<T>(self, right: T) -> Expr
where T: Into<Expr>,

Express an sqlite retrieves JSON field and casts it to an appropriate SQL type (->>). Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.