pub struct Expr<'scope, T> { /* private fields */ }Expand description
A type representing an expression in the query, can be passed around on the rust side to wire things up
Implementations§
Source§impl<'scope> Expr<'scope, i32>
impl<'scope> Expr<'scope, i32>
pub fn add(self, other: Self) -> Self
Sourcepub fn nextval(name: &str) -> Self
pub fn nextval(name: &str) -> Self
generate nextval('name'), this must be used within Query::evaluate
for it to behave properly.
§Example
use rust_rel8::{helper_tables::One, *};
query::<(Expr<i32>, Expr<i32>)>(|q| {
let id = q.q(Query::evaluate(Expr::nextval("table_id_seq")));
let v = q.q(Query::values([1, 2, 3].map(|a| One { a })));
(id, v.a)
});Trait Implementations§
Source§impl<T> ShortenLifetime for Expr<'static, T>
impl<T> ShortenLifetime for Expr<'static, T>
type Shortened<'small> = Expr<'small, T> where Self: 'small
Source§fn shorten_lifetime<'small, 'large: 'small>(self) -> Self::Shortened<'small>where
Self: 'large,
fn shorten_lifetime<'small, 'large: 'small>(self) -> Self::Shortened<'small>where
Self: 'large,
Shorten a lifetime, normally rust does this automatically, but if
the lifetime is invariant due to being used in a Gat or trait, we
need to do it manually. Read more
Source§impl<'scope, T> Table<'scope> for Expr<'scope, T>
impl<'scope, T> Table<'scope> for Expr<'scope, T>
Source§impl<T: for<'r> Decode<'r, Any>> TableLoaderSqlx for Expr<'static, T>
Available on crate feature sqlx only.
impl<T: for<'r> Decode<'r, Any>> TableLoaderSqlx for Expr<'static, T>
Available on crate feature
sqlx only.Source§fn load<'a>(
&self,
values: &mut impl Iterator<Item = AnyValueRef<'a>>,
) -> Self::Result
fn load<'a>( &self, values: &mut impl Iterator<Item = AnyValueRef<'a>>, ) -> Self::Result
Load the table given an iterator over a row’s values
Source§fn skip<'a>(&self, values: &mut impl Iterator<Item = AnyValueRef<'a>>)
fn skip<'a>(&self, values: &mut impl Iterator<Item = AnyValueRef<'a>>)
discard N columns from the iterator ofer a row
This is used when this value was discarded by a MaybeTable.
Auto Trait Implementations§
impl<'scope, T> Freeze for Expr<'scope, T>
impl<'scope, T> !RefUnwindSafe for Expr<'scope, T>
impl<'scope, T> !Send for Expr<'scope, T>
impl<'scope, T> !Sync for Expr<'scope, T>
impl<'scope, T> Unpin for Expr<'scope, T>where
T: Unpin,
impl<'scope, T> !UnwindSafe for Expr<'scope, T>
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> 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 more