Filtering
The queries that support pagination will also provide the facility of filtering out the results. This is helpful in narrowing down the result set based in your preferences.
In such queries, we provide the an input parameter called where
, which will mostly be inside the input parameter or in some cases will b the top level parameter.
Let's see an example:
query getDomains { getDomains (input: { where: { DomainName: { _like: "%Vercel%"} } }) { count data { DomainId DomainName } } }
Here you see the where input parameter in action inside the input parameter.
Notice the parameter called _eq
. This means that the SkillName should be equal to the given value.
On the lowest level - that is, the leaf node of an object which is a primitive type - we provide the following operations for comparison:
_eq
:String
. Equal to the provided value_gt
:String
. Greater than the provided value_gte
:String
. Greater than or equal to the provided value_in
:[String!]
. Resulting value must be one of the provided values_is_null
:Boolean
. Resulting value must be null_like
:String
. Resulting value must be like the provided value, not requiring that it is an exact match. The value for this operator must be provided as'%value%'
,'%value'
or'value%'
._lt
:String
. Less than the provided value._lte
:String
. Less than or equal to the provided value._neq
:String
. Not equal to the provided value._nin
:[String!]
. Result should not be within the provided input array._nlike
:String
. Negation of the like operator mentioned above.
Multiple values to compare using where
parameter
Inside the where parameter and the value it is currently focusing on, you will see that the where clause can be applied on multiple fields in the result set.
Taking the example from the above example:
query getDomains { getDomains (input: { where: { DomainId: { _eq: 10} DomainName: { _like: "%Vercel%"} } }) { count data { DomainId DomainName } } }
Notice that we now have the DomainId
in the picture as well.