A note about what schema is
A full GraphQL schema that will be deployed can include user-defined types (UDTs), object types, indexes, queries, mutations, and payload types. The next sections describes the definition of these items before discussing how to deploy the schema once created.
Do you want to understand deployment first? Read Deploy Schema. |
Data types
A column’s CQL data type is inferred from the GraphQL field type. GraphQL’s built-in scalar types are mapped:
GraphQL | CQL |
---|---|
ID |
uuid |
String |
varchar |
Int |
int |
Float |
double |
Boolean |
boolean |
In addition, Stargate provides a set of custom scalar types that map directly to the CQL types of the same name: Uuid, TimeUuid, Inet, Date, Duration, BigInt, Counter, Ascii, Decimal, Varint, Float32, Blob, SmallInt, TinyInt, Timestamp, Time.
Sets and lists are defined by custom typed arrays. Maps and tuples are not supported, but UDTs can be used to create the same functionality.
In GraphQL syntax, square brackets denote an array, such as email: [String]
defines a field named email that is an array of String values.
Additionally, if an exclamation point follows a data type, such as String!
,
then the field cannot contain a null value.