Skip to main content
Version: 2.0.x

Query Filters

Seaography has a rich set of built-in filters for different data types.

OperatorGraphQL FieldSupported Types
= / !=eq / neString, String-like, Integer, Float, Boolean, Json
> / >=gt / gteString, String-like, Integer, Float, Boolean
< / <=lt / lteString, String-like, Integer, Float, Boolean
case insensitive =ci_eqString
IN (..) / NOT IN (..)is_in / is_not_inString, String-like, Integer, Float, Boolean
IS NULLis_nullString, String-like, Integer, Float, Boolean
contains (LIKE '%abc%')containsString
starts_with (LIKE 'abc%')starts_withString
ends_with (LIKE '%abc')ends_withString
LIKE / NOT LIKElike / not_likeString
ILIKE (Postgres)ilikeString
BETWEEN / NOT BETWEENbetween / not_betweenString, String-like, Integer, Float
contains @> (Postgres)array_containsArray
contained <@ (Postgres)array_containedArray
overlap && (Postgres)array_overlapArray

Date, DateTime, Decimal etc are String-like.

IS NULL

There is no IS NOT NULL, because is_null has a single bool value, with false meaning IS NOT NULL.

{
address(
filters: { postalCode: { is_null: true } }
) {
nodes {
address
postalCode
}
}
}

ILIKE

Postgres only. Requires custom config in BuilderContext:

EntityQueryFieldConfig {
use_ilike: true,
..Default::default()
}
{
customer(filters: {
firstName: {
ilike: "mario%"
}
}) {
nodes {
firstName
lastName
}
}
}

array_*

Postgres only.

{
film(filters: {
title: { contains: "LIFE" }
specialFeatures: { array_contains: ["Trailers"] }
}) {
nodes {
title
specialFeatures
}
}
}

Chaining Filters

You can specify multi fields in filters and they will be chained with AND.

You can also combine multiple filters with AND / OR:

{
film(
filters: {
or: [{ title: { contains: "LIFE" } }, { title: { contains: "WAR" } }]
}
) {
nodes {
title
}
}
}

Results in following SQL:

WHERE `film`.`title` LIKE '%LIFE%' OR `film`.`title` LIKE '%WAR%'

Some Examples

{
customer(filters: {
firstName: {
is_in: ["PETER", "MARY"]
}
}) {
nodes {
firstName
lastName
}
}
}
{
address(filters: { address: { contains: "Lane" } }) {
nodes {
address
address2
postalCode
}
}
}