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>where
Select<'a, T>: ToQuery<'a, T>,
Query<'a, T>: Executable<Output = T>,
impl<'a, T: Sync + Send + 'a> IntoFuture for Select<'a, T>where Select<'a, T>: ToQuery<'a, T>, Query<'a, T>: Executable<Output = T>,
§type IntoFuture = Pin<Box<dyn Future<Output = <Select<'a, T> as IntoFuture>::Output> + 'a, Global>>
type IntoFuture = Pin<Box<dyn Future<Output = <Select<'a, T> as IntoFuture>::Output> + 'a, Global>>
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 = Vec<Row, Global>> !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, Global>> !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