Graphback Scalars
Graphback supports common used Int
, Float
, String
, Boolean
, 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
GraphbackJSONObject
andGraphbackJSON
. - 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.
#
Table SummaryScalar | Description | Database Type |
---|---|---|
GraphbackTime | A time string at UTC, such as 10:15:30Z, compliant with the full-time format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar. | time |
GraphbackDate | A date string, such as 2007-12-03, compliant with the full-date format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar. | date |
GraphbackDateTime | A date-time string at UTC, such as 2007-12-03T10:15:30Z, compliant with the date-time format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar. | datetime |
GraphbackObjectID | 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 mongodb package installed in order to use this | varchar(24) |
GraphbackJSONObject | The JSONObject scalar type represents JSON objects as specified by ECMA-404. | json |
GraphbackJSON | The JSON scalar type represents JSON values as specified by ECMA-404. | json |
GraphbackTimestamp | The javascript Date as integer. Type represents date and time as number of milliseconds from start of UNIX epoch. | timestamp |
note
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.
info
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.
#
Example UsageTake an example Note
model, which uses each of the scalar types: ID
, String
, GraphbackDateTime
.
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 2020-07-27T12:11:41.288Z
: