pub struct Cursor<E: EntityTrait, M> { /* private fields */ }Expand description
Implementations§
Source§impl<E: EntityTrait, M: FromQueryResult> Cursor<E, M>
impl<E: EntityTrait, M: FromQueryResult> Cursor<E, M>
Sourcepub fn after(self, key: impl IntoValueTuple) -> Self
pub fn after(self, key: impl IntoValueTuple) -> Self
Returns rows whose key is strictly greater than key.
Sourcepub fn before(self, key: impl IntoValueTuple) -> Self
pub fn before(self, key: impl IntoValueTuple) -> Self
Returns rows whose key is strictly less than key.
Sourcepub fn last(self, n: u64) -> Self
pub fn last(self, n: u64) -> Self
Takes the last n rows of the key range, still returned in key order.
The statement reads them in reverse order with LIMIT n and the
result is reversed in memory, which is the only way to take the tail
of a range without knowing its size.
Sourcepub fn into_model<T: FromQueryResult>(self) -> Cursor<E, T>
pub fn into_model<T: FromQueryResult>(self) -> Cursor<E, T>
Decodes rows into T instead of the current result type.
Sourcepub async fn all<C: ConnectionTrait>(&self, db: &C) -> Result<Vec<M>>
pub async fn all<C: ConnectionTrait>(&self, db: &C) -> Result<Vec<M>>
Fetches the page, in key order.
§Errors
Returns DbErr::Driver when the query fails
or a row cannot be decoded.
Sourcepub fn key_columns(&self) -> Vec<&'static str>
pub fn key_columns(&self) -> Vec<&'static str>
The names of the key columns, most significant first.
Trait Implementations§
Auto Trait Implementations§
impl<E, M> Freeze for Cursor<E, M>
impl<E, M> RefUnwindSafe for Cursor<E, M>
impl<E, M> Send for Cursor<E, M>
impl<E, M> Sync for Cursor<E, M>
impl<E, M> Unpin for Cursor<E, M>
impl<E, M> UnsafeUnpin for Cursor<E, M>
impl<E, M> UnwindSafe for Cursor<E, 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<T> ErasedDestructor for Twhere
T: 'static,
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