graph-gophers / graphql-go

GraphQL server with a focus on ease of use
BSD 2-Clause "Simplified" License
4.64k stars 491 forks source link

A simpler way to add logic for filtering with logical operators #518

Closed frederikhors closed 2 years ago

frederikhors commented 2 years ago

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:

QUESTIONS

  1. What do you think about? Pros and cons of each choice?

  2. 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?

  3. Has anyone faced this problem before?

I apologize for opening an issue but I don't see the discussion tab active.

pavelnikolov commented 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.