pub struct Projected<M> { /* private fields */ }Expand description
A SELECT of specific columns or aggregates, created with
Select::select. Decode rows into tuples or any sqlx::FromRow type.
Implementations§
Source§impl<M> Projected<M>where
M: Model,
impl<M> Projected<M>where
M: Model,
Sourcepub async fn fetch_all<'e, T, E>(self, executor: E) -> Result<Vec<T>, Error>
pub async fn fetch_all<'e, T, E>(self, executor: E) -> Result<Vec<T>, Error>
Fetch every row, decoded into T (a tuple or a FromRow type).
Sourcepub async fn fetch_optional<'e, T, E>(
self,
executor: E,
) -> Result<Option<T>, Error>
pub async fn fetch_optional<'e, T, E>( self, executor: E, ) -> Result<Option<T>, Error>
Fetch the first row, or None.
Sourcepub async fn fetch_one<'e, T, E>(self, executor: E) -> Result<T, Error>
pub async fn fetch_one<'e, T, E>(self, executor: E) -> Result<T, Error>
Fetch the first row, failing with Error::NotFound.
Trait Implementations§
Auto Trait Implementations§
impl<M> !RefUnwindSafe for Projected<M>
impl<M> !UnwindSafe for Projected<M>
impl<M> Freeze for Projected<M>
impl<M> Send for Projected<M>
impl<M> Sync for Projected<M>
impl<M> Unpin for Projected<M>
impl<M> UnsafeUnpin for Projected<M>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<M> InScope<(M, ()), Here> for M
impl<M, Rest, N> InScope<(M, (Rest, N)), Last> for N
impl<X, M, Rest, N, I> InScope<(M, (Rest, N)), There<I>> for X
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