Closed frederikhors closed 2 years ago
@frederikhors to be honest I do not know how to respond to this question. Currently there isn't a recommended way to handle this as far as I know. I have never had to work with similar filters in GraphQL and I am not sure what to suggest. With that being said, this doesn't seem to be an issue with the library per se and I am going to close it. I can start a discussion if you want or maybe you can ask in the #graphql channel in the Gophers Slack.
I'm using GraphQL in Golang with gqlgen and Bun as ORM.
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 try graph-gophers is it possible to have a "global" way to map our Graphql structs to our domain code without manually write that logic by ourself?
Has anyone faced this problem before?
I apologize for opening an issue but I don't see the discussion tab active.