The Goodies

The output schema automatically supports OpenCRUD filtering, pagination and ordering

Filtering

All the scalar entity types enjoy first-class support in the output schema when it comes to filtering. The standard is known as OpenCRUD and dictates what the filtering should look like depending on the field type. For example, if the input schema defines the following type:

type Person @entity {
    name: String!
    married: Boolean
    age: Int
    account: Bytes! @unique
    salary: BigInt
    interests: [String]
}

the output schema will support the following query:

query {
    persons(where: { name_startsWith: "Joh", age_gt: 20 }) {
      name
    }
}

Pagination

All queries enjoy pagination support by accepting offset and limit input parameters. By default, limit is set to 5.

query {
    persons(offset: 10, limit: 5) {
      name
    }
}

Ordering

The results can also be ordered by any property with natural ordering. The _DESCand _ASC suffixes indicate the direction:

query {
    persons(offset: 10, limit: 5, orderBy: name_ASC) {
      name
    }
}

Last updated