pub struct Query {
pub resource: Resource,
pub selection: Selection,
pub arguments: Option<Value>,
pub projection: Option<Projection>,
pub context: Context,
pub cache_policy: Option<CachePolicy>,
pub deadline: Option<Deadline>,
}Expand description
A read-only, side-effect-free request against a named Resource.
A Query is always carried inside a Message with
operation = Query.
Fields§
§resource: ResourceThe named target.
selection: SelectionOptional filter predicate selecting a subset of the resource.
arguments: Option<Value>Optional named arguments to the resolver.
projection: Option<Projection>Optional field projection narrowing which fields are returned.
context: ContextExecution context (deadline, principal, trace, cache policy).
cache_policy: Option<CachePolicy>Optional override of the cache policy in Context.
deadline: Option<Deadline>Optional override of the deadline in Context.
Implementations§
Source§impl Query
impl Query
Sourcepub fn new(resource: Resource) -> Self
pub fn new(resource: Resource) -> Self
Construct a minimal query against a resource with default
selection (All) and default context.
Sourcepub fn with_selection(self, s: Selection) -> Self
pub fn with_selection(self, s: Selection) -> Self
Set the selection.
Sourcepub fn with_projection(self, p: Projection) -> Self
pub fn with_projection(self, p: Projection) -> Self
Set the projection. Returns an error via the resolver if
include and exclude are both non-empty.
Sourcepub fn with_arguments(self, args: Value) -> Self
pub fn with_arguments(self, args: Value) -> Self
Set the arguments.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Query
impl<'de> Deserialize<'de> for Query
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 StructuralPartialEq for Query
Auto Trait Implementations§
impl Freeze for Query
impl RefUnwindSafe for Query
impl Send for Query
impl Sync for Query
impl Unpin for Query
impl UnsafeUnpin for Query
impl UnwindSafe for Query
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