pub struct TableQuery<Key: ToKey, Record: TableRecord> { /* private fields */ }Expand description
GraphQL Pagination through TableIndex
This allows you to query a TableIndex using the GraphQL Pagination Spec.
range, gt, ge, lt, le, gt_raw, ge_raw, lt_raw, and le_raw define a range. The range initially covers the entire index; each of these functions shrink it (set intersection).
first, last, before,
and after page through the range. They conform to
the Pagination Spec, except query produces an
error if both first and last are Some.
Implementations§
Source§impl<Key: ToKey, Record: TableRecord + OutputType> TableQuery<Key, Record>
impl<Key: ToKey, Record: TableRecord + OutputType> TableQuery<Key, Record>
Sourcepub fn new(table_index: TableIndex<Key, Record>) -> Self
pub fn new(table_index: TableIndex<Key, Record>) -> Self
Query a table’s index
Sourcepub fn subindex<RemainingKey: ToKey>(
table_index: TableIndex<Key, Record>,
subkey: &impl ToKey,
) -> TableQuery<RemainingKey, Record>
pub fn subindex<RemainingKey: ToKey>( table_index: TableIndex<Key, Record>, subkey: &impl ToKey, ) -> TableQuery<RemainingKey, Record>
Query a subindex of a table
Holds the first field(s) of a key constant, while searching and iterating through the remaining fields of the key.
Parameters:
- Type argument
RemainingKey: specifies the types of the remaining fields. If there’s more than 1 remaining field, then use a tuple. table_index: The table index to query.subkey: Provides the key fields that remain constant. If there’s more than 1 field, then use a tuple.
Sourcepub fn first(self, n: Option<i32>) -> Self
pub fn first(self, n: Option<i32>) -> Self
Limit the result to the first n (if Some) matching records.
This replaces the current value.
Sourcepub fn last(self, n: Option<i32>) -> Self
pub fn last(self, n: Option<i32>) -> Self
Limit the result to the last n (if Some) matching records.
This replaces the current value.
Sourcepub fn before(self, cursor: Option<String>) -> Self
pub fn before(self, cursor: Option<String>) -> Self
Resume paging. Limits the result to records before cursor
(if Some). cursor is opaque; get it from a
previously-returned
Connection.
This replaces the current value.
Sourcepub fn after(self, cursor: Option<String>) -> Self
pub fn after(self, cursor: Option<String>) -> Self
Resume paging. Limits the result to records after cursor
(if Some). cursor is opaque; get it from a
previously-returned
Connection.
This replaces the current value.
Sourcepub fn gt(self, key: Option<&Key>) -> Self
pub fn gt(self, key: Option<&Key>) -> Self
Limit the result to records with keys greater than key.
If key is Some then this intersects with the existing range.
Sourcepub fn ge(self, key: Option<&Key>) -> Self
pub fn ge(self, key: Option<&Key>) -> Self
Limit the result to records with keys greater than or
equal to key.
If key is Some then this intersects with the existing range.
Sourcepub fn lt(self, key: Option<&Key>) -> Self
pub fn lt(self, key: Option<&Key>) -> Self
Limit the result to records with keys less than key.
If key is Some then this intersects with the existing range.
Sourcepub fn le(self, key: Option<&Key>) -> Self
pub fn le(self, key: Option<&Key>) -> Self
Limit the result to records with keys less than or
equal to key.
If key is Some then this intersects with the existing range.
Sourcepub fn range(self, bounds: impl RangeBounds<Key>) -> Self
pub fn range(self, bounds: impl RangeBounds<Key>) -> Self
Limit the result to records with keys within range.
This intersects with the existing range.
Sourcepub fn gt_raw(self, key: RawKey) -> Self
pub fn gt_raw(self, key: RawKey) -> Self
Limit the result to records with keys greater than key.
This intersects with the existing range. key must include
the index’s prefix.
Sourcepub fn ge_raw(self, key: RawKey) -> Self
pub fn ge_raw(self, key: RawKey) -> Self
Limit the result to records with keys greater than or
equal to key.
This intersects with the existing range. key must include
the index’s prefix.
Sourcepub fn lt_raw(self, key: RawKey) -> Self
pub fn lt_raw(self, key: RawKey) -> Self
Limit the result to records with keys less than key.
This intersects with the existing range. key must include
the index’s prefix.
Sourcepub fn le_raw(self, key: RawKey) -> Self
pub fn le_raw(self, key: RawKey) -> Self
Limit the result to records with keys less than or
equal to key.
This intersects with the existing range. key must include
the index’s prefix.