docs/docs/api-reference/relay-graphql-api/query.mdx
query|subscription [<op-name>] {
connection-object [([argument])]{
connection-object-fields
}
}
| Key | Required | Schema | Description |
|---|---|---|---|
| op-name | false | Value | Name query/subscription for observability |
| connection-object | true | ConnectionObject | Name of the table connection |
| argument | false | Argument | One or more filter criteria, instructions for sorting order or pagination |
Example: Relay Query
query {
author_connection(first: 2) {
pageInfo {
hasNextPage
endCursor
}
edges {
cursor
node {
id
name
username
}
}
}
}
Example: Relay Subscription
subscription {
author_connection(first: 2){
pageInfo {
hasNextPage
endCursor
}
edges {
cursor
node {
id
name
username
}
}
}
}q
:::info Note
For details of usage, please see this page.
:::
connection-object {
pageInfo: {
hasNextPage
hasPreviousPage
startCursor
endCursor
}
edges: {
cursor
node: {
id
field1
field2
json_field[(path: String)]
..
nested object1
nested object2
aggregate nested object1
..
}
}
}
| Field | Type |
|---|---|
| pageInfo | PageInfo! |
| edges | [Edge!]! |
:::info Note
For more details on the Relay connection object type, refer to the
Relay docs.
:::
Information useful for pagination.
type PageInfo {
hasNextPage: Boolean!
hasPreviousPage: Boolean!
startCursor: String!
endCursor: String!
}
:::info Note
For more details on the Relay PageInfo object type, refer to the
Relay docs.
:::
Edge is an object type that consists of a cursor and node fields. node is a table object type which
implements the Relay Node interface.
type tableEdge {
cursor: String!
node: table!
}
The cursor field returns a unique non-null String value which is useful for pagination.
:::info Note
For more details on the Relay cursor, refer to the Relay docs.
:::
Same as the generic DistinctOnExp
Same as the generic WhereExp
Same as the generic OrderByExp
Forward Pagination:
<div className="parsed-literal"> <pre> <code> {`first: Integer [after: `} <a href='#cursor'>Cursor</a> {`]`} </code> </pre> </div>query {
article_connection(first: 2, after: "eyJpZCIgOiAzfQ==") {
pageInfo {
startCursor
endCursor
hasPreviousPage
hasNextPage
}
edges {
cursor
node {
title
content
author_id
}
}
}
}
Backward Pagination:
<div className="parsed-literal"> <pre> <code> {`[last: Integer] [before: `} <a href='#cursor'>Cursor</a> {`]`} </code> </pre> </div>query {
article_connection(last: 2, before: "eyJpZCIgOiA0fQ==") {
pageInfo {
startCursor
endCursor
hasPreviousPage
hasNextPage
}
edges {
cursor
node {
title
content
author_id
}
}
}
}