hasura / hasura/graphql-engine

`table_find_one` field to return a single object

Open
#4,288 0 comments 4 reactions 1 assignee Claimed by @0x777 View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.