A simpler way to add logic for filtering with logical operators #938
Unanswered
frederikhors
asked this question in
Q&A
Replies: 1 comment
-
In HotChocolate there is built-in filtering: https://chillicream.com/docs/hotchocolate/v13/fetching-data/filtering. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
For now I'm using GraphQL in Golang with gqlgen and Bun as ORM.
I would like to use Rust in the near future and imagine using Async-Graphql and SeaORM.
I'm using DDD and Clean architecture, meaning that I'm avoiding
one-size-fits-all/lock-in
solutions like Hasura, Postgraphile, DGraph and everything like that; I can (and I eventually will, no hurry) write and organize my code in such a way to achieve their features.For now I'm wondering about complex queries with filters like:
AND
,OR
,NOT
(better described here).Right now I need to think/write/test code all by myself and this certainly does not speed up production of the software I want to write.
Also, my code will almost certainly be slow, buggy and possibly all wrong as soon as I realize that I will need something extra for this feature.
After all, this is true for all software and is one of the reasons why open source was born.
After some research I noticed there are two approaches to solving the problem of GraphQL data filtering:
create all possible combinations for each field of the model (this is how ent behaves and other users suggest)
create input types that contain the model fields but also logical comparators as a possible value (like Hasura, Postgraphile and others do)
QUESTIONS
What do you think about? Pros and cons of each choice?
If I wanna use
async-graphql
is it possible to have an easier way to map our Graphql structs to our domain code without manually write that logic by ourself?Has anyone faced this problem before?
Beta Was this translation helpful? Give feedback.
All reactions