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(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§
Source§impl UpdateStatement
impl UpdateStatement
Sourcepub fn new() -> UpdateStatement
pub fn new() -> UpdateStatement
Construct a new UpdateStatement
pub fn take(&mut self) -> UpdateStatement
Sourcepub fn table<T>(&mut self, tbl_ref: T) -> &mut UpdateStatementwhere
T: IntoTableRef,
pub fn table<T>(&mut self, tbl_ref: T) -> &mut UpdateStatementwhere
T: IntoTableRef,
Sourcepub fn from<R>(&mut self, tbl_ref: R) -> &mut UpdateStatementwhere
R: IntoTableRef,
pub fn from<R>(&mut self, tbl_ref: R) -> &mut UpdateStatementwhere
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()]
);Sourcepub fn values<T, I>(&mut self, values: I) -> &mut UpdateStatement
pub fn values<T, I>(&mut self, values: I) -> &mut UpdateStatement
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(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(), []);Sourcepub fn value<C, T>(&mut self, col: C, value: T) -> &mut UpdateStatement
pub fn value<C, T>(&mut self, col: C, value: T) -> &mut UpdateStatement
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(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"#
);Sourcepub fn limit(&mut self, limit: u64) -> &mut UpdateStatement
pub fn limit(&mut self, limit: u64) -> &mut UpdateStatement
Limit number of updated rows.
Sourcepub fn returning(&mut self, returning: ReturningClause) -> &mut UpdateStatement
pub fn returning(&mut self, returning: ReturningClause) -> &mut UpdateStatement
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(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()]
);Sourcepub fn returning_col<C>(&mut self, col: C) -> &mut UpdateStatementwhere
C: IntoColumnRef,
pub fn returning_col<C>(&mut self, col: C) -> &mut UpdateStatementwhere
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(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""#
);Sourcepub fn returning_all(&mut self) -> &mut UpdateStatement
pub fn returning_all(&mut self) -> &mut UpdateStatement
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(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 *"#
);Sourcepub fn with(self, clause: WithClause) -> WithQuery
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(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()]
);Sourcepub fn with_cte<C>(&mut self, clause: C) -> &mut UpdateStatementwhere
C: Into<WithClause>,
pub fn with_cte<C>(&mut self, clause: C) -> &mut UpdateStatementwhere
C: Into<WithClause>,
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()]
);Sourcepub fn get_values(&self) -> &[(DynIden, Box<Expr>)]
pub fn get_values(&self) -> &[(DynIden, Box<Expr>)]
Get column values
Source§impl UpdateStatement
impl UpdateStatement
Sourcepub fn build_collect_any_into(
&self,
query_builder: &impl QueryBuilder,
sql: &mut impl SqlWriter,
)
pub fn build_collect_any_into( &self, query_builder: &impl QueryBuilder, sql: &mut impl SqlWriter, )
Sourcepub fn build_any(&self, query_builder: &impl QueryBuilder) -> (String, Values)
pub fn build_any(&self, query_builder: &impl QueryBuilder) -> (String, Values)
Sourcepub fn build_collect_any(
&self,
query_builder: &impl QueryBuilder,
sql: &mut impl SqlWriter,
) -> String
pub fn build_collect_any( &self, query_builder: &impl QueryBuilder, sql: &mut impl SqlWriter, ) -> String
Source§impl UpdateStatement
impl UpdateStatement
Sourcepub fn build_collect_into<T>(&self, query_builder: T, sql: &mut impl SqlWriter)where
T: QueryBuilder,
pub fn build_collect_into<T>(&self, query_builder: T, sql: &mut impl SqlWriter)where
T: QueryBuilder,
Sourcepub fn build_collect<T>(
&self,
query_builder: T,
sql: &mut impl SqlWriter,
) -> Stringwhere
T: QueryBuilder,
pub fn build_collect<T>(
&self,
query_builder: T,
sql: &mut impl SqlWriter,
) -> Stringwhere
T: QueryBuilder,
Sourcepub fn build<T>(&self, query_builder: T) -> (String, Values)where
T: QueryBuilder,
pub fn build<T>(&self, query_builder: T) -> (String, Values)where
T: QueryBuilder,
Sourcepub fn to_string<T>(&self, query_builder: T) -> Stringwhere
T: QueryBuilder,
pub fn to_string<T>(&self, query_builder: T) -> Stringwhere
T: QueryBuilder,
Source§impl UpdateStatement
impl UpdateStatement
Sourcepub fn add_order_by(&mut self, order: OrderExpr) -> &mut UpdateStatement
pub fn add_order_by(&mut self, order: OrderExpr) -> &mut UpdateStatement
Sourcepub fn clear_order_by(&mut self) -> &mut UpdateStatement
pub fn clear_order_by(&mut self) -> &mut UpdateStatement
Sourcepub fn order_by<T>(&mut self, col: T, order: Order) -> &mut UpdateStatementwhere
T: IntoColumnRef,
pub fn order_by<T>(&mut self, col: T, order: Order) -> &mut UpdateStatementwhere
T: IntoColumnRef,
Sourcepub fn order_by_expr(
&mut self,
expr: Expr,
order: Order,
) -> &mut UpdateStatement
pub fn order_by_expr( &mut self, expr: Expr, order: Order, ) -> &mut UpdateStatement
Sourcepub fn order_by_customs<I, T>(&mut self, cols: I) -> &mut UpdateStatement
pub fn order_by_customs<I, T>(&mut self, cols: I) -> &mut UpdateStatement
Sourcepub fn order_by_columns<I, T>(&mut self, cols: I) -> &mut UpdateStatement
pub fn order_by_columns<I, T>(&mut self, cols: I) -> &mut UpdateStatement
Sourcepub fn order_by_with_nulls<T>(
&mut self,
col: T,
order: Order,
nulls: NullOrdering,
) -> &mut UpdateStatementwhere
T: IntoColumnRef,
pub fn order_by_with_nulls<T>(
&mut self,
col: T,
order: Order,
nulls: NullOrdering,
) -> &mut UpdateStatementwhere
T: IntoColumnRef,
Sourcepub fn order_by_expr_with_nulls(
&mut self,
expr: Expr,
order: Order,
nulls: NullOrdering,
) -> &mut UpdateStatement
pub fn order_by_expr_with_nulls( &mut self, expr: Expr, order: Order, nulls: NullOrdering, ) -> &mut UpdateStatement
Sourcepub fn order_by_customs_with_nulls<I, T>(
&mut self,
cols: I,
) -> &mut UpdateStatement
pub fn order_by_customs_with_nulls<I, T>( &mut self, cols: I, ) -> &mut UpdateStatement
Sourcepub fn order_by_columns_with_nulls<I, T>(
&mut self,
cols: I,
) -> &mut UpdateStatement
pub fn order_by_columns_with_nulls<I, T>( &mut self, cols: I, ) -> &mut UpdateStatement
Source§impl UpdateStatement
impl UpdateStatement
Sourcepub fn and_or_where(
&mut self,
condition: LogicalChainOper,
) -> &mut UpdateStatement
pub fn and_or_where( &mut self, condition: LogicalChainOper, ) -> &mut UpdateStatement
Sourcepub fn cond_where<C>(&mut self, condition: C) -> &mut UpdateStatementwhere
C: IntoCondition,
pub fn cond_where<C>(&mut self, condition: C) -> &mut UpdateStatementwhere
C: IntoCondition,
Sourcepub fn and_where_option(&mut self, other: Option<Expr>) -> &mut UpdateStatement
pub fn and_where_option(&mut self, other: Option<Expr>) -> &mut UpdateStatement
Sourcepub fn and_where(&mut self, other: Expr) -> &mut UpdateStatement
pub fn and_where(&mut self, other: Expr) -> &mut UpdateStatement
Trait Implementations§
Source§impl AuditTrait for UpdateStatement
impl AuditTrait for UpdateStatement
fn audit(&self) -> Result<QueryAccessAudit, Error>
Source§fn audit_unwrap(&self) -> QueryAccessAudit
fn audit_unwrap(&self) -> QueryAccessAudit
Shorthand for
audit().unwrap()Source§impl Clone for UpdateStatement
impl Clone for UpdateStatement
Source§fn clone(&self) -> UpdateStatement
fn clone(&self) -> UpdateStatement
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl ConditionalStatement for UpdateStatement
impl ConditionalStatement for UpdateStatement
Source§fn cond_where<C>(&mut self, condition: C) -> &mut UpdateStatementwhere
C: IntoCondition,
fn cond_where<C>(&mut self, condition: C) -> &mut UpdateStatementwhere
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 moreSource§impl Debug for UpdateStatement
impl Debug for UpdateStatement
Source§impl Default for UpdateStatement
impl Default for UpdateStatement
Source§fn default() -> UpdateStatement
fn default() -> UpdateStatement
Returns the “default value” for a type. Read more
Source§impl From<UpdateStatement> for Expr
impl From<UpdateStatement> for Expr
Source§fn from(v: UpdateStatement) -> Expr
fn from(v: UpdateStatement) -> Expr
Converts to this type from the input type.
Source§impl From<UpdateStatement> for QueryStatement
impl From<UpdateStatement> for QueryStatement
Source§fn from(s: UpdateStatement) -> QueryStatement
fn from(s: UpdateStatement) -> QueryStatement
Converts to this type from the input type.
Source§impl From<UpdateStatement> for SubQueryStatement
impl From<UpdateStatement> for SubQueryStatement
Source§fn from(s: UpdateStatement) -> SubQueryStatement
fn from(s: UpdateStatement) -> SubQueryStatement
Converts to this type from the input type.
Source§impl OrderedStatement for UpdateStatement
impl OrderedStatement for UpdateStatement
Source§fn clear_order_by(&mut self) -> &mut UpdateStatement
fn clear_order_by(&mut self) -> &mut UpdateStatement
Clear order expressions
Source§fn order_by<T>(&mut self, col: T, order: Order) -> &mut Selfwhere
T: IntoColumnRef,
fn order_by<T>(&mut self, col: T, order: Order) -> &mut Selfwhere
T: IntoColumnRef,
Order by column. Read more
Source§fn order_by_customs<I, T>(&mut self, cols: I) -> &mut Self
fn order_by_customs<I, T>(&mut self, cols: I) -> &mut Self
Order by custom string.
Source§fn order_by_columns<I, T>(&mut self, cols: I) -> &mut Self
fn order_by_columns<I, T>(&mut self, cols: I) -> &mut Self
Order by vector of columns.
Source§fn order_by_with_nulls<T>(
&mut self,
col: T,
order: Order,
nulls: NullOrdering,
) -> &mut Selfwhere
T: IntoColumnRef,
fn order_by_with_nulls<T>(
&mut self,
col: T,
order: Order,
nulls: NullOrdering,
) -> &mut Selfwhere
T: IntoColumnRef,
Order by column with nulls order option. Read more
Source§fn order_by_expr_with_nulls(
&mut self,
expr: Expr,
order: Order,
nulls: NullOrdering,
) -> &mut Self
fn order_by_expr_with_nulls( &mut self, expr: Expr, order: Order, nulls: NullOrdering, ) -> &mut Self
Order by
Expr with nulls order option.Source§fn order_by_customs_with_nulls<I, T>(&mut self, cols: I) -> &mut Self
fn order_by_customs_with_nulls<I, T>(&mut self, cols: I) -> &mut Self
Order by custom string with nulls order option.
Source§fn order_by_columns_with_nulls<I, T>(&mut self, cols: I) -> &mut Self
fn order_by_columns_with_nulls<I, T>(&mut self, cols: I) -> &mut Self
Order by vector of columns with nulls order option.
Source§impl PartialEq for UpdateStatement
impl PartialEq for UpdateStatement
Source§impl QueryStatementBuilder for UpdateStatement
impl QueryStatementBuilder for UpdateStatement
Source§fn build_collect_any_into(
&self,
query_builder: &impl QueryBuilder,
sql: &mut impl SqlWriter,
)
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
Source§fn build_any(&self, query_builder: &impl QueryBuilder) -> (String, Values)
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
Source§fn build_collect_any(
&self,
query_builder: &impl QueryBuilder,
sql: &mut impl SqlWriter,
) -> String
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
Source§impl QueryStatementWriter for UpdateStatement
impl QueryStatementWriter for UpdateStatement
fn build_collect_into<T>(&self, query_builder: T, sql: &mut impl SqlWriter)where
T: QueryBuilder,
Source§fn to_string<T>(&self, query_builder: T) -> Stringwhere
T: QueryBuilder,
fn to_string<T>(&self, query_builder: T) -> Stringwhere
T: QueryBuilder,
Build corresponding SQL statement for certain database backend and return SQL string Read more
Source§fn build<T>(&self, query_builder: T) -> (String, Values)where
T: QueryBuilder,
fn build<T>(&self, query_builder: T) -> (String, Values)where
T: QueryBuilder,
Build corresponding SQL statement for certain database backend and collect query parameters into a vector Read more
Source§fn build_collect<T>(&self, query_builder: T, sql: &mut impl SqlWriter) -> Stringwhere
T: QueryBuilder,
fn build_collect<T>(&self, query_builder: T, sql: &mut impl SqlWriter) -> Stringwhere
T: QueryBuilder,
Build corresponding SQL statement for certain database backend and collect query parameters Read more
Source§impl SqlxBinder for UpdateStatement
impl SqlxBinder for UpdateStatement
fn build_sqlx<T>(&self, query_builder: T) -> (String, SqlxValues)where
T: QueryBuilder,
Source§impl StatementBuilder for UpdateStatement
impl StatementBuilder for UpdateStatement
impl StructuralPartialEq for UpdateStatement
Auto Trait Implementations§
impl Freeze for UpdateStatement
impl RefUnwindSafe for UpdateStatement
impl Send for UpdateStatement
impl Sync for UpdateStatement
impl Unpin for UpdateStatement
impl UnsafeUnpin for UpdateStatement
impl UnwindSafe for UpdateStatement
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ExprTrait for T
impl<T> ExprTrait for T
Source§fn as_enum<N>(self, type_name: N) -> Exprwhere
N: IntoIden,
fn as_enum<N>(self, type_name: N) -> Exprwhere
N: IntoIden,
Express a
AS enum expression. Read moreSource§fn cast_as<N>(self, type_name: N) -> Exprwhere
N: IntoIden,
fn cast_as<N>(self, type_name: N) -> Exprwhere
N: IntoIden,
Express a
CAST AS expression. Read moreSource§fn count_distinct(self) -> Expr
fn count_distinct(self) -> Expr
Express a
COUNT function with the DISTINCT modifier. Read moreSource§fn equals<C>(self, col: C) -> Exprwhere
C: IntoColumnRef,
fn equals<C>(self, col: C) -> Exprwhere
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
Source§fn in_subquery(self, sel: SelectStatement) -> Expr
fn in_subquery(self, sel: SelectStatement) -> Expr
Express a
IN sub-query expression. Read moreSource§fn in_tuples<V, I>(self, v: I) -> Exprwhere
V: IntoValueTuple,
I: IntoIterator<Item = V>,
fn in_tuples<V, I>(self, v: I) -> Exprwhere
V: IntoValueTuple,
I: IntoIterator<Item = V>,
Express a
IN sub expression. Read moreSource§fn is_not_null(self) -> Expr
fn is_not_null(self) -> Expr
Express a
IS NOT NULL expression. Read moreSource§fn left_shift<R>(self, right: R) -> Expr
fn left_shift<R>(self, right: R) -> Expr
Express a bitwise left shift. Read more
Source§fn not_between<A, B>(self, a: A, b: B) -> Expr
fn not_between<A, B>(self, a: A, b: B) -> Expr
Express a
NOT BETWEEN expression. Read moreSource§fn not_equals<C>(self, col: C) -> Exprwhere
C: IntoColumnRef,
fn not_equals<C>(self, col: C) -> Exprwhere
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
Source§fn not_in_subquery(self, sel: SelectStatement) -> Expr
fn not_in_subquery(self, sel: SelectStatement) -> Expr
Express a
NOT IN sub-query expression. Read moreSource§fn not_like<L>(self, like: L) -> Exprwhere
L: IntoLikeExpr,
fn not_like<L>(self, like: L) -> Exprwhere
L: IntoLikeExpr,
Express a
NOT LIKE expression. Read moreSource§fn right_shift<R>(self, right: R) -> Expr
fn right_shift<R>(self, right: R) -> Expr
Express a bitwise right shift. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> PgExpr for Twhere
T: ExprTrait,
impl<T> PgExpr for Twhere
T: ExprTrait,
Source§fn concatenate<T>(self, right: T) -> Expr
fn concatenate<T>(self, right: T) -> Expr
Express an postgres concatenate (
||) expression. Read moreSource§fn matches<T>(self, expr: T) -> Expr
fn matches<T>(self, expr: T) -> Expr
Express an postgres fulltext search matches (
@@) expression. Read moreSource§fn contains<T>(self, expr: T) -> Expr
fn contains<T>(self, expr: T) -> Expr
Express an postgres fulltext search contains (
@>) expression. Read moreSource§fn contained<T>(self, expr: T) -> Expr
fn contained<T>(self, expr: T) -> Expr
Express an postgres fulltext search contained (
<@) expression. Read moreSource§fn ilike<L>(self, like: L) -> Exprwhere
L: IntoLikeExpr,
fn ilike<L>(self, like: L) -> Exprwhere
L: IntoLikeExpr,
Express a
ILIKE expression. Read moreSource§fn not_ilike<L>(self, like: L) -> Exprwhere
L: IntoLikeExpr,
fn not_ilike<L>(self, like: L) -> Exprwhere
L: IntoLikeExpr,
Express a
NOT ILIKE expressionSource§fn get_json_field<T>(self, right: T) -> Expr
fn get_json_field<T>(self, right: T) -> Expr
Express a postgres retrieves JSON field as JSON value (
->). Read more