Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make one condition in filter optional? #123

Open
koote opened this issue May 16, 2024 · 1 comment
Open

How to make one condition in filter optional? #123

koote opened this issue May 16, 2024 · 1 comment

Comments

@koote
Copy link

koote commented May 16, 2024

I have a query structure defined like this:

type queryAccounts struct {
	Accounts []struct {
            ID string        graphql.String `graphql:"id"`   
            Type string    graphql.String `graphql:"type"`    
            Region string  graphql.String `graphql:"region"`
            Owners string  []graphql.String `graphql:"owners"`
        }`graphql:"allAccountsList(filter:{region: {equalTo: $region}, types:{in: $types}})"`
}

The problem is, the filter [types](types:{in: $types}}) is not always needed. Sometimes i want to query with filter like region=west, types=["test","production","preproduction"], sometimes i just want to query with filter region=east.
How to make the filter types optional? thanks.

@koote
Copy link
Author

koote commented May 16, 2024

Or, is there a way to pass in a full filter string when query?

@koote koote changed the title How to make filter condition optional? How to make one condition in filter optional? May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant