Skip to main content

TableQuery

Struct TableQuery 

Source
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>

Source

pub fn new(table_index: TableIndex<Key, Record>) -> Self

Query a table’s index

Source

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.
Source

pub fn first(self, n: Option<i32>) -> Self

Limit the result to the first n (if Some) matching records.

This replaces the current value.

Source

pub fn last(self, n: Option<i32>) -> Self

Limit the result to the last n (if Some) matching records.

This replaces the current value.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn range(self, bounds: impl RangeBounds<Key>) -> Self

Limit the result to records with keys within range.

This intersects with the existing range.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub async fn query(self) -> Result<Connection<RawKey, Record>>

Auto Trait Implementations§

§

impl<Key, Record> Freeze for TableQuery<Key, Record>
where TableIndex<Key, Record>: Freeze,

§

impl<Key, Record> RefUnwindSafe for TableQuery<Key, Record>
where TableIndex<Key, Record>: RefUnwindSafe,

§

impl<Key, Record> Send for TableQuery<Key, Record>
where TableIndex<Key, Record>: Send,

§

impl<Key, Record> Sync for TableQuery<Key, Record>
where TableIndex<Key, Record>: Sync,

§

impl<Key, Record> Unpin for TableQuery<Key, Record>
where TableIndex<Key, Record>: Unpin,

§

impl<Key, Record> UnsafeUnpin for TableQuery<Key, Record>
where TableIndex<Key, Record>: UnsafeUnpin,

§

impl<Key, Record> UnwindSafe for TableQuery<Key, Record>
where TableIndex<Key, Record>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<Reference, Outer, OuterFieldType, Inner> HasPart<Nested<Outer, Inner>> for Reference
where Reference: HasPart<Outer> + ?Sized, Outer: Part<PartType = Field<OuterFieldType>>, Inner: Part, OuterFieldType: HasPart<Inner, RawTarget = OuterFieldType> + PartialRefTarget + ?Sized,

Source§

unsafe fn part_ptr( ptr: *const <Reference as PartialRefTarget>::RawTarget, ) -> <<Inner as Part>::PartType as PartType>::Ptr

Given a constant pointer to a target, produce a constant pointer to a part of it. Read more
Source§

unsafe fn part_ptr_mut( ptr: *mut <Reference as PartialRefTarget>::RawTarget, ) -> <<Inner as Part>::PartType as PartType>::PtrMut

Given a mutable pointer to a target, produce a mutable pointer to a part of it. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more