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>,
/* private fields */
}
Expand description
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.