pub struct Cursor {
pub column: String,
pub value: CursorValue,
pub direction: CursorDirection,
}Expand description
Cursor for cursor-based pagination.
Fields§
§column: StringThe column to use for cursor.
value: CursorValueThe cursor value.
direction: CursorDirectionDirection of pagination.
Implementations§
Source§impl Cursor
impl Cursor
Sourcepub fn new(
column: impl Into<String>,
value: CursorValue,
direction: CursorDirection,
) -> Self
pub fn new( column: impl Into<String>, value: CursorValue, direction: CursorDirection, ) -> Self
Create a new cursor.
Sourcepub fn after(column: impl Into<String>, value: impl Into<CursorValue>) -> Self
pub fn after(column: impl Into<String>, value: impl Into<CursorValue>) -> Self
Create a cursor for fetching records after this value.
Sourcepub fn before(column: impl Into<String>, value: impl Into<CursorValue>) -> Self
pub fn before(column: impl Into<String>, value: impl Into<CursorValue>) -> Self
Create a cursor for fetching records before this value.
Sourcepub fn to_sql_condition(&self) -> String
pub fn to_sql_condition(&self) -> String
Generate the WHERE clause for cursor-based pagination.
Optimized to write directly to a pre-sized buffer.
Sourcepub fn write_sql_condition(&self, buffer: &mut String)
pub fn write_sql_condition(&self, buffer: &mut String)
Write the cursor condition directly to a buffer (zero allocation).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Cursor
impl<'de> Deserialize<'de> for Cursor
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Cursor
impl StructuralPartialEq for Cursor
Auto Trait Implementations§
impl Freeze for Cursor
impl RefUnwindSafe for Cursor
impl Send for Cursor
impl Sync for Cursor
impl Unpin for Cursor
impl UnwindSafe for Cursor
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)