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

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.

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.

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.

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.

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]

[src]

Returns the decoded equivalent of an empty query string. Does not require any allocations.

[src]

Returns a query builder that can be used to create a new query.

Trait Implementations

impl Clone for Query
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Query
[src]

[src]

Formats the value using the given formatter.

impl Default for Query
[src]

[src]

Returns the "default value" for a type. Read more

impl PartialEq for Query
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl<'de> Deserialize<'de> for Query
[src]

[src]

Deserialize this value from the given Serde deserializer. Read more

impl Serialize for Query
[src]

[src]

Serialize this value into the given Serde serializer. Read more