Entity queries
For all queries that support sorting, filtering and pagination they work the same way. If an entity query has different behavior this will be described separately.
In all field parameters the field of a child entity can be referenced using a dot.
To request all domains from server 3 with there pointers:
query Domain($serverId: String!) {
Domain(filter: {field: "server.id", value: $serverId, operator: "$eq"}) {
id
accessLogs
mainPhp
pointers {
id
pointer
}
}
}
Filtering
Filtering is done trough the filter
parameter and is of FilterInput.
type FilterInput {
field: String
value: String
operator: String
children: [FilterInput]
}
This parameter semi supports sequelizejs filters (see http://docs.sequelizejs.com/en/v3/docs/querying/#operators).
operator starts with $ and is then treated as one of the following operators. When operator is empty $eq is asumed.
Supported operators are:
- Combine filters where all are required
$and
- Combine filters where any of is required
$or
- Greater then
$gt
- Greater then or equal to
$gte
- Less then
$lt
- Less then or equal to
$lte
- Not equal to
$ne
- Between
$between
, requires two children with value filled. - Not between
$notBetween
, requires two children with value filled. - In
$in
, requires minimal 1 child with value filled. - Not in
$notIn
, requires minimal 1 child with value filled. - Contains
$like
- Not contains
$notLike
Combinations are supported with the children field for example:
var variables = {"filter": {
"operator": "$or",
"children": [
{
"operator": "$gt",
"field": "rank",
"value": 1000
},
{
"operator": "$lt",
"field": 'rank',
"value": 10000
}
]
}}
Sorting
Sorting is done using the sort
parameter of SortInput
type SortInput {
field: String!
direction: SortDirection
}
enum SortDirection {
desc
asc
}
var variables = {"sort": {
"field": "createdAt",
"direction": "desc"
}}
Pagination
Pagination is done with the skip
and limit
parameters.