pub struct CursorParams<const MAX: u64 = 100, const DEFAULT: u64 = 20> {
pub after: Option<String>,
pub before: Option<String>,
pub limit: Option<u64>,
}Expand description
?after=TOKEN or ?before=TOKEN, and ?limit=N from 1 to MAX,
DEFAULT when absent.
Without a token the first page is returned. Both tokens together, an
out-of-range or non-numeric limit are rejected with 422 before the
handler runs, and the documented query parameters state the bounds.
Use it as Query<CursorParams> (at most 100, default 20) or choose
the bounds: Query<CursorParams<500, 50>>.
Fields§
§after: Option<String>The next cursor of the previous page: continue after it.
before: Option<String>The previous cursor of a page: the page before it.
limit: Option<u64>Items per page.
Implementations§
Source§impl<const MAX: u64, const DEFAULT: u64> CursorParams<MAX, DEFAULT>
impl<const MAX: u64, const DEFAULT: u64> CursorParams<MAX, DEFAULT>
Sourcepub async fn fetch<M: Model>(
&self,
queryset: QuerySet<M>,
) -> Result<CursorPage<M>, OrmError>
pub async fn fetch<M: Model>( &self, queryset: QuerySet<M>, ) -> Result<CursorPage<M>, OrmError>
Fetch this page of queryset (one statement, no count).
§Errors
OrmError::Cursor for a token the queryset rejects (answered
with 400 by ApiError), capability or backend errors.
Trait Implementations§
Source§impl<const MAX: u64, const DEFAULT: u64> Clone for CursorParams<MAX, DEFAULT>
impl<const MAX: u64, const DEFAULT: u64> Clone for CursorParams<MAX, DEFAULT>
Source§fn clone(&self) -> CursorParams<MAX, DEFAULT>
fn clone(&self) -> CursorParams<MAX, DEFAULT>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<const MAX: u64, const DEFAULT: u64> Default for CursorParams<MAX, DEFAULT>
impl<const MAX: u64, const DEFAULT: u64> Default for CursorParams<MAX, DEFAULT>
Source§fn default() -> CursorParams<MAX, DEFAULT>
fn default() -> CursorParams<MAX, DEFAULT>
Returns the “default value” for a type. Read more
Source§impl<'de, const MAX: u64, const DEFAULT: u64> Deserialize<'de> for CursorParams<MAX, DEFAULT>
impl<'de, const MAX: u64, const DEFAULT: u64> Deserialize<'de> for CursorParams<MAX, DEFAULT>
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<const MAX: u64, const DEFAULT: u64> Eq for CursorParams<MAX, DEFAULT>
Source§impl<const MAX: u64, const D: u64> Schema for CursorParams<MAX, D>
impl<const MAX: u64, const D: u64> Schema for CursorParams<MAX, D>
Source§fn schema(_: &mut SchemaRegistry) -> SchemaObject
fn schema(_: &mut SchemaRegistry) -> SchemaObject
The schema definition of this type. Use
SchemaRegistry::subschema for nested types.Source§fn schema_name() -> Option<&'static str>
fn schema_name() -> Option<&'static str>
Stable component name. Named types are emitted once under
components.schemas and referenced with $ref.impl<const MAX: u64, const DEFAULT: u64> StructuralPartialEq for CursorParams<MAX, DEFAULT>
Source§impl<const MAX: u64, const D: u64> Validate for CursorParams<MAX, D>
impl<const MAX: u64, const D: u64> Validate for CursorParams<MAX, D>
Source§fn prepare(input: &mut Value, ctx: &mut ValidationContext)
fn prepare(input: &mut Value, ctx: &mut ValidationContext)
Check and normalise the raw input for this type in place.
Source§fn validate(&self, _ctx: &mut ValidationContext)
fn validate(&self, _ctx: &mut ValidationContext)
Check invariants of the deserialized value.
Auto Trait Implementations§
impl<const MAX: u64, const DEFAULT: u64> Freeze for CursorParams<MAX, DEFAULT>
impl<const MAX: u64, const DEFAULT: u64> RefUnwindSafe for CursorParams<MAX, DEFAULT>
impl<const MAX: u64, const DEFAULT: u64> Send for CursorParams<MAX, DEFAULT>
impl<const MAX: u64, const DEFAULT: u64> Sync for CursorParams<MAX, DEFAULT>
impl<const MAX: u64, const DEFAULT: u64> Unpin for CursorParams<MAX, DEFAULT>
impl<const MAX: u64, const DEFAULT: u64> UnsafeUnpin for CursorParams<MAX, DEFAULT>
impl<const MAX: u64, const DEFAULT: u64> UnwindSafe for CursorParams<MAX, DEFAULT>
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> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> ServiceExt for T
impl<T> ServiceExt for T
§fn compression(self) -> Compression<Self>where
Self: Sized,
fn compression(self) -> Compression<Self>where
Self: Sized,
Compresses response bodies. Read more
§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using HTTP status codes. Read more
§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using gRPC headers. Read more
§fn override_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn override_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
Insert a header into the request. Read more
§fn append_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn append_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
Append a header into the request. Read more
§fn insert_request_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn insert_request_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
Insert a header into the request, if the header is not already present. Read more
§fn override_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn override_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
Insert a header into the response. Read more
§fn append_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn append_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
Append a header into the response. Read more
§fn insert_response_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn insert_response_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
Insert a header into the response, if the header is not already present. Read more
§fn set_request_id<M>(
self,
header_name: HeaderName,
make_request_id: M,
) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
fn set_request_id<M>(
self,
header_name: HeaderName,
make_request_id: M,
) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
Add request id header and extension. Read more
§fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
Add request id header and extension, using
x-request-id as the header name. Read more§fn propagate_request_id(
self,
header_name: HeaderName,
) -> PropagateRequestId<Self>where
Self: Sized,
fn propagate_request_id(
self,
header_name: HeaderName,
) -> PropagateRequestId<Self>where
Self: Sized,
Propgate request ids from requests to responses. Read more
§fn propagate_x_request_id(self) -> PropagateRequestId<Self>where
Self: Sized,
fn propagate_x_request_id(self) -> PropagateRequestId<Self>where
Self: Sized,
Propgate request ids from requests to responses, using
x-request-id as the header name. Read more§fn request_body_limit(self, limit: usize) -> RequestBodyLimit<Self>where
Self: Sized,
fn request_body_limit(self, limit: usize) -> RequestBodyLimit<Self>where
Self: Sized,
Intercept requests with over-sized payloads and convert them into
413 Payload Too Large responses. Read more§fn trim_trailing_slash(self) -> NormalizePath<Self>where
Self: Sized,
fn trim_trailing_slash(self) -> NormalizePath<Self>where
Self: Sized,
Remove trailing slashes from paths. Read more
§fn append_trailing_slash(self) -> NormalizePath<Self>where
Self: Sized,
fn append_trailing_slash(self) -> NormalizePath<Self>where
Self: Sized,
Append trailing slash to paths. Read more