hasura / hasura/graphql-engine

where argument support for computed column (that have arguments)

Open
#7,094 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

I'd like to be able to filter out results in a gql query based on a computed field.

For example:
Assuming a computed field called searchScore which returns a real value indicating how close a match this record is..

```CREATE OR REPLACE FUNCTION public.person_search_score(p persons, searchtext text) RETURNS real```

```
query MyQuery($searchText: String!) {
persons(where: {searchScore: {_gt: 1}}) {
id
first_name
last_name
nickname
searchScore(args: {searchtext:$searchText})
}
}

```

Contributor guide

Open the contributing guide

Research direction

Read the issue's computed-field example and the GraphQL `where` argument behavior for computed fields. Determine how arguments supplied to `searchScore` should be applied when filtering by that field; done means a query can filter `persons` using the computed field with its arguments, while still returning the requested field value.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, postgresql, typescript
Domain
api, databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.