Graphback supports commonly used
ID GraphQL scalars types. On top of these scalars, Graphback goes a step further by bringing in support of additional integration of scalar types making writing modern applications easy. This integration, offers
- Out of the box proven scalar resolvers thanks to GraphQL Scalars library.
- Generation of the required input types for filtering except for
- Automatic inferring of the required underlying database when using the GraphQL Migrations package.
The table below shows the scalar types that Graphback supports out of the box.
|A time string at UTC, such as 10:15:30Z, compliant with the |
|A date string, such as 2007-12-03, compliant with the |
|A date-time string at UTC, such as 2007-12-03T10:15:30Z, compliant with the |
|A field whose value conforms with the standard mongodb object ID as described here: https://docs.mongodb.com/manual/reference/method/ObjectId/#ObjectId. You will need to have the |
To be able to use either of those scalars, they will need to be defined in your Graphback Business Model file as shown in the example below.
Custom scalar types will need to be specified as you normally would i.e specifying the scalar in the model and configuring the corresponding resolvers.
Take an example
Note model, which uses each of the scalar types:
The highlighted code shows how you can define and use one of the Graphback scalars.
Graphback generates a filter input type for each model in the schema.
With the generated
GraphbackDateTimeInput having the following fields:
So you can perform filtering of the data like this to retrive notes created after
For your convenience, Graphback generates a filter input for
Timestamp scalars. However we only fully support the scalars outlined above and we recommend you to use these.