Skip to main content

gqlConnection

gqlConnection is the type of a gqlField to indicate that it should be exposed as a GraphQL Connection on the source object that follows the Relay Spec.

It takes the name of the node that's going to be at the end of the connection.

Usually used to query the database in custom ways.

It expects the method to return a Custom EntQuery otherwise things won't work.

For example:

src/account.ts
export class Account extends AccountBase {

@gqlField({ name: "openTodos", type: gqlConnection("Todo") })
openTodos() {

return new AccountToOpenTodosQuery(this.viewer, this);

}
}