pub struct Select<'a, T = Vec<Row>> { /* private fields */ }
Expand description
A struct which holds the information needed to build
a SELECT
query.
Implementations§
Source§impl<'a, T> Select<'a, T>
impl<'a, T> Select<'a, T>
Sourcepub fn where_(self, where_: Where<'a>) -> Select<'a, T>
pub fn where_(self, where_: Where<'a>) -> Select<'a, T>
Add a WHERE
clause to your query.
If used multiple time, the conditions are joined
using AND
.
Sourcepub fn where_raw(
self,
statement: impl Into<String>,
params: Vec<&'a (dyn ToSql + Sync)>,
) -> Select<'a, T>
pub fn where_raw( self, statement: impl Into<String>, params: Vec<&'a (dyn ToSql + Sync)>, ) -> Select<'a, T>
Add a raw WHERE
clause to your query.
You can reference the params
by using the ?
placeholder in your statement.
Note: you need to pass the exact types Postgres is expecting. Failure to do so will result in (sometimes confusing) runtime errors.
Otherwise this behaves exactly like where_
.
§Example
ⓘ
Book::select()
.where_(Book::id.neq(&3))
.where_raw("complex_function(book.title, ?, ?)", vec![&true, &"Foobar"])
.await?;
Trait Implementations§
Source§impl<'a, T: Sync + Send + 'a> IntoFuture for Select<'a, T>
impl<'a, T: Sync + Send + 'a> IntoFuture for Select<'a, T>
Source§type IntoFuture = Pin<Box<dyn Future<Output = <Select<'a, T> as IntoFuture>::Output> + 'a>>
type IntoFuture = Pin<Box<dyn Future<Output = <Select<'a, T> as IntoFuture>::Output> + 'a>>
Which kind of future are we turning this into?
Source§fn into_future(self) -> Self::IntoFuture
fn into_future(self) -> Self::IntoFuture
Creates a future from a value. Read more
Auto Trait Implementations§
impl<'a, T> Freeze for Select<'a, T>
impl<'a, T = Vec<Row>> !RefUnwindSafe for Select<'a, T>
impl<'a, T> Send for Select<'a, T>where
T: Send,
impl<'a, T> Sync for Select<'a, T>where
T: Sync,
impl<'a, T> Unpin for Select<'a, T>where
T: Unpin,
impl<'a, T = Vec<Row>> !UnwindSafe for Select<'a, 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