hasura / hasura/graphql-engine
`table_find_one` field to return a single object
Open
a/api
c/server
k/enhancement
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
Currently, the only generic api for fetching records is the `table` field which has a type of `[table]`. This is cumbersome to use if the API is supposed to return only one row (deterministically) as you need to peek into the array structure.
We can have a `table_find_one` field which takes the same arguments as the generic `table` field. The behaviour is as follows:
- If the query returns one row, then an object is returned
- If the query returns multiple rows, then an error is returned EXCEPT if an order can be determined via the `order_by` argument. If an order can be determined, then the first row is returned.
Contributor guide
Assessment
This issue has not been assessed yet.