Custom Operators
FastGQL defines a set of operators that can be used to extend the schema. These operators are defined in the fastgql.graphql
file.
These operators are used to run filters and queries on the database. By default, FastGQL supports common operators:
eq
- equalsne
- not equalsgt
- greater thanlt
- less thangte
- greater than or equallte
- less than or equalin
- innin
- not inlike
- likeilike
- ilikeisNull
- is nullcontains
- containsnotContains
- not containsoverlap
- overlapcontainedBy
- contained bysuffix
- suffixprefix
- prefix
Adding Custom Operators
FastGQL allows you to add custom operators to the schema. This can be done by defining a new input type in the fastgql.graphql
file,
or by adding a new operator to an existing input type, by extending the input type.
We will define our custom operator to always do “1 = 1”
In our serve.go
where we define our schema, we will add a resolver for the custom operator.
An example of a custom operator can be found here.
Adding FilterInputs for Custom Scalar Types
Similar to how StringComparator is used to filter strings, you can define a custom input type to filter custom scalar types.