pub struct GraphqlOffsetPagination {
pub type: OffsetPaginationKind,
pub offset_variable: String,
pub page_size: usize,
pub stop_when_short: bool,
pub substitute_in_query: bool,
}Expand description
Offset-into-query-variable pagination (ShopifyQL and similar).
Increments an integer offset injected into a GraphQL variable and
terminates on a short page (fewer than page_size records) — unlike
cursor pagination, which follows a pageInfo boolean. Suited to APIs whose
query language embeds LIMIT … OFFSET … (e.g. ShopifyQL): bake the limit
into the query string and parameterize only the offset with ${…}.
The offset starts at 0, is sent as a JSON number in the variables map on
every request, and advances by page_size after each page.
Fields§
§type: OffsetPaginationKindDiscriminator — must be Offset.
offset_variable: StringName of the GraphQL variable that receives the current offset. It is
injected as a JSON number (starting at 0, incremented by page_size
after each page). Reference it from the query string or as a variable
(e.g. ${q_offset} for ShopifyQL).
page_size: usizeRecords requested per page. Used both to advance the offset
(offset += page_size) and, with stop_when_short, to detect the final
page. Must be greater than 0. This value is not injected into the
request — bake the limit into your query (LIMIT 250 OFFSET ${q_offset}).
stop_when_short: boolTerminate when a page yields fewer than page_size records (default
true). When false, pagination continues until a fully empty page (or
max_pages) is reached.
substitute_in_query: boolSubstitute ${offset_variable} occurrences in the query string with
the current offset before each request, instead of sending it as a
GraphQL variable. Required for query languages that embed the offset in a
string-literal argument — e.g. ShopifyQL’s
shopifyqlQuery(query: "… LIMIT 250 OFFSET ${q_offset}"), where a GraphQL
variable cannot interpolate into a string literal (#569). Default
false (variable injection, the #550 behavior).
Trait Implementations§
Source§impl Clone for GraphqlOffsetPagination
impl Clone for GraphqlOffsetPagination
Source§fn clone(&self) -> GraphqlOffsetPagination
fn clone(&self) -> GraphqlOffsetPagination
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GraphqlOffsetPagination
impl Debug for GraphqlOffsetPagination
Source§impl<'de> Deserialize<'de> for GraphqlOffsetPagination
impl<'de> Deserialize<'de> for GraphqlOffsetPagination
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>,
Source§impl JsonSchema for GraphqlOffsetPagination
impl JsonSchema for GraphqlOffsetPagination
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more