Struct json_api::query::Query
[−]
[src]
pub struct Query { pub fields: Map<Key, Set>, pub filter: Map<Path, Value>, pub include: Set<Path>, pub page: Option<Page>, pub sort: Set<Sort>, // some fields omitted }
Represents well-known query parameters.
Fields
fields: Map<Key, Set>
A map where each key is a type name and the value is set of field names that the client wishes to receive for the given type. If this is not present when decoding a query string, an empty map is used (no allocation is required).
It is recommeneded that consumers of this crate interpret a None
value as the
client specifying that they want all of the available fields for a given type.
This behavior is already implemented when rendering a type that implements the
Resource
trait via the resource!
macro.
For more information, check out the sparse fieldsets section of the JSON API specification.
filter: Map<Path, Value>
A map where each key is a field path and the value is the value the client would like each item in the return document to have for the given field.
For more information, check out the [filter] section of the JSON API specification.
include: Set<Path>
A set of relationship paths that specify included resources a client wishes to receive in addition to a document's primary data.
For more information, check out the inclusion of related resources section of the JSON API specification.
page: Option<Page>
Optional pagination parameters. To make life easier when this value is None
,
the Page
struct implements a sensible default.
For more information, check out the pagination section of the JSON API specification.
sort: Set<Sort>
A set of sort instructions. Each element in the set contains the field name, and the sort direction (ascending or descending).
When a client specifies a field to sort by, if it is prefixed with '-'
(i.e
sort=-created-at
) the instruction is interpreted to mean "sort by the field
'created-at' in descending order".
For more information, check out the sorting section of the JSON API specification.
Methods
impl Query
[src]
fn new() -> Self
[src]
Returns the decoded equivalent of an empty query string. Does not require any allocations.
fn builder() -> Builder
[src]
Returns a query builder that can be used to create a new query.
Trait Implementations
impl Clone for Query
[src]
fn clone(&self) -> Query
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Query
[src]
impl Default for Query
[src]
impl PartialEq for Query
[src]
fn eq(&self, __arg_0: &Query) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Query) -> bool
[src]
This method tests for !=
.
impl<'de> Deserialize<'de> for Query
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more