pub struct Returning;
Expand description
Shorthand for constructing ReturningClause
Implementations§
source§impl Returning
impl Returning
sourcepub fn all(&self) -> ReturningClause
pub fn all(&self) -> ReturningClause
Constructs a new ReturningClause::All
.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::delete()
.from_table(Glyph::Table)
.and_where(Expr::col(Glyph::Id).eq(1))
.returning(Query::returning().all())
.to_owned();
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"DELETE FROM "glyph" WHERE "id" = 1 RETURNING *"#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"DELETE FROM "glyph" WHERE "id" = 1 RETURNING *"#
);
sourcepub fn column<C>(&self, col: C) -> ReturningClausewhere
C: IntoColumnRef,
pub fn column<C>(&self, col: C) -> ReturningClausewhere
C: IntoColumnRef,
Constructs a new ReturningClause::Columns
.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::delete()
.from_table(Glyph::Table)
.and_where(Expr::col(Glyph::Id).eq(1))
.returning(Query::returning().column(Glyph::Id))
.to_owned();
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"DELETE FROM "glyph" WHERE "id" = 1 RETURNING "id""#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"DELETE FROM "glyph" WHERE "id" = 1 RETURNING "id""#
);
sourcepub fn columns<T, I>(self, cols: I) -> ReturningClausewhere
T: IntoColumnRef,
I: IntoIterator<Item = T>,
pub fn columns<T, I>(self, cols: I) -> ReturningClausewhere
T: IntoColumnRef,
I: IntoIterator<Item = T>,
Constructs a new ReturningClause::Columns
.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::delete()
.from_table(Glyph::Table)
.and_where(Expr::col(Glyph::Id).eq(1))
.returning(Query::returning().columns([Glyph::Id, Glyph::Image]))
.to_owned();
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"DELETE FROM "glyph" WHERE "id" = 1 RETURNING "id", "image""#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"DELETE FROM "glyph" WHERE "id" = 1 RETURNING "id", "image""#
);
sourcepub fn expr<T>(&self, expr: T) -> ReturningClausewhere
T: Into<SimpleExpr>,
pub fn expr<T>(&self, expr: T) -> ReturningClausewhere
T: Into<SimpleExpr>,
Constructs a new ReturningClause::Exprs
.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::delete()
.from_table(Glyph::Table)
.and_where(Expr::col(Glyph::Id).eq(1))
.returning(Query::returning().expr(Expr::col(Glyph::Id)))
.to_owned();
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"DELETE FROM "glyph" WHERE "id" = 1 RETURNING "id""#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"DELETE FROM "glyph" WHERE "id" = 1 RETURNING "id""#
);
sourcepub fn exprs<T, I>(self, exprs: I) -> ReturningClause
pub fn exprs<T, I>(self, exprs: I) -> ReturningClause
Constructs a new ReturningClause::Exprs
.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::delete()
.from_table(Glyph::Table)
.and_where(Expr::col(Glyph::Id).eq(1))
.returning(Query::returning().exprs([Expr::col(Glyph::Id), Expr::col(Glyph::Image)]))
.to_owned();
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"DELETE FROM "glyph" WHERE "id" = 1 RETURNING "id", "image""#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"DELETE FROM "glyph" WHERE "id" = 1 RETURNING "id", "image""#
);
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Returning
impl RefUnwindSafe for Returning
impl Send for Returning
impl Sync for Returning
impl Unpin for Returning
impl UnwindSafe for Returning
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)