Schema/Metadata API Reference: Common syntax definitions¶
Table of contents
- TableName
- QualifiedTable
- FunctionName
- QualifiedFunction
- RoleName
- ComputedFieldName
- PGColumnType
- PGColumn
- RelationshipName
- BoolExp
- AndExp
- OrExp
- NotExp
- ExistsExp
- TrueExp
- ColumnExp
- Operator
- Object
- Empty Object
- ColumnPresetsExp
- RemoteSchemaName
- RemoteSchemaDef
- CollectionName
- QueryName
- CollectionQuery
- EndpointUrl
- EndpointMethods
- EndpointDefinition
- CustomColumnNames
- ActionName
- WebhookURL
- HeaderFromValue
- HeaderFromEnv
- GraphQLType
- GraphQLName
TableName¶
String | QualifiedTable
QualifiedTable¶
{
"name": String,
"schema": String
}
FunctionName¶
String | QualifiedFunction
QualifiedFunction¶
{
"name": String,
"schema": String
}
RoleName¶
String
ComputedFieldName¶
String
PGColumnType¶
String
Numeric types
Type Alias Description serialautoincrementing integer bigserialautoincrementing bigint integer4 bytes, typical choice for integer smallint2 bytes bigint8 bytes realfloat46 decimal digits precision, inexact double precisionfloat815 decimal digits precision, inexact numericdecimalarbitrary precision, exact Character types
Type Alias Description varchartexttypical choice for storing string types Date/Time types
Type Alias Description timestamp with time zonetimestamptzboth date and time, with time zone. Allowed values should be of ISO8601 format. E.g. 2016-07-20T17:30:15Z, 2016-07-20T17:30:15+05:30, 2016-07-20T17:30:15.234890+05:30 time with time zonetimetztime of day only, with time zone. Allowed values should be of ISO8601 format. E.g. 17:30:15Z, 17:30:15+05:30, 17:30:15.234890+05:30 datedate (no time of day). Allowed values are yyyy-mm-dd Boolean type
Type Alias Description booleanstate of true or false JSON types
Type Alias Description jsonStored as plain text jsonbStored in a binary format and can be indexed
PGColumn¶
String
RelationshipName¶
String
TrueExp¶
{}
Operator¶
Generic operators (all column types except json, jsonb) :
| Operator | PostgreSQL equivalent |
|---|---|
"$eq" |
= |
"$ne" |
<> |
"$gt" |
> |
"$lt" |
< |
"$gte" |
>= |
"$lte" |
<= |
"$in" |
IN |
"$nin" |
NOT IN |
(For more details, refer to the Postgres docs for comparison operators and list based search operators.)
Text related operators :
| Operator | PostgreSQL equivalent |
|---|---|
"$like" |
LIKE |
"$nlike" |
NOT LIKE |
"$ilike" |
ILIKE |
"$nilike" |
NOT ILIKE |
"$similar" |
SIMILAR TO |
"$nsimilar" |
NOT SIMILAR TO |
$regex |
~ |
$iregex |
~* |
$nregex |
!~ |
$niregex |
!~* |
(For more details on text related operators, refer to the Postgres docs.)
Operators for comparing columns (all column types except json, jsonb):
| Operator | PostgreSQL equivalent |
|---|---|
"$ceq" |
= |
"$cne" |
<> |
"$cgt" |
> |
"$clt" |
< |
"$cgte" |
>= |
"$clte" |
<= |
(For more details on comparison operators, refer to the Postgres docs.)
Checking for NULL values :
| Operator | PostgreSQL equivalent |
|---|---|
_is_null (takes true/false as values) |
IS NULL |
(For more details on the IS NULL expression, refer to the Postgres docs.)
JSONB operators :
| Operator | PostgreSQL equivalent |
|---|---|
_contains |
@> |
_contained_in |
<@ |
_has_key |
? |
_has_keys_any |
?! |
_has_keys_all |
?& |
(For more details on JSONB operators, refer to the Postgres docs.)
PostGIS related operators on GEOMETRY columns:
| Operator | PostGIS equivalent |
|---|---|
_st_contains |
ST_Contains(column, input) |
_st_crosses |
ST_Crosses(column, input) |
_st_equals |
ST_Equals(column, input) |
_st_intersects |
ST_Intersects(column, input) |
_st_overlaps |
ST_Overlaps(column, input) |
_st_touches |
ST_Touches(column, input) |
_st_within |
ST_Within(column, input) |
_st_d_within |
ST_DWithin(column, input) |
(For more details on spatial relationship operators, refer to the PostGIS docs.)
Note
All operators take a JSON representation of
geometry/geographyvalues as input value.The input value for
_st_d_withinoperator is an object:{ field-name : {_st_d_within: {distance: Float, from: Value} } }
ColumnPresetsExp¶
A JSONObject of a Postgres column name to value mapping, where the value can be static or derived from a session variable.
{
"column1" : colVal1,
"column2" : colVal2,
..
}
E.g. where id is derived from a session variable and city is a static value.
{
"id" : "x-hasura-User-Id",
"city" : "San Francisco"
}
Note
If the value of any key begins with “x-hasura-” (case-insensitive), the value of the column specified in the key will be derived from a session variable of the same name.
RemoteSchemaName¶
String
RemoteSchemaDef¶
{
"url" : url-string,
"url_from_env" : env-var-string,
"headers": [
{ "name": header-name-string,
"value": header-value-string,
"value_from_env": env-var-string
}
],
"forward_client_headers": boolean,
"timeout_seconds": integer
}
CollectionName¶
String
QueryName¶
String
CollectionQuery¶
{
"name": String,
"query": String
}
EndpointUrl¶
String
EndpointMethods¶
[String]
EndpointDefinition¶
{
"query": {
"query_name : String,
"collection_name" : CollectionName
}
}
CustomColumnNames¶
A JSONObject of Postgres column name to GraphQL name mapping
{
"column1" : String,
"column2" : String,
..
}
ActionName¶
String
WebhookURL¶
A String value which supports templating environment variables enclosed in {{ and }}.
String
Template example: https://{{ACTION_API_DOMAIN}}/create-user
HeaderFromValue¶
| Key | required | Schema | Description |
|---|---|---|---|
| name | true | String | Name of the header |
| value | true | String | Value of the header |
HeaderFromEnv¶
| Key | required | Schema | Description |
|---|---|---|---|
| name | true | String | Name of the header |
| value_from_env | true | String | Name of the environment variable which holds the value of the header |
GraphQLType¶
A GraphQL Type Reference string.
String
Example: String! for non-nullable String type and [String] for array of String types