stufflog graphql server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
388 B

  1. package graphutil
  2. import (
  3. "context"
  4. "github.com/99designs/gqlgen/graphql"
  5. )
  6. func SelectsAnyField(ctx context.Context, fields ...string) bool {
  7. collectedFields := graphql.CollectFieldsCtx(ctx, []string{"description"})
  8. for _, collectedField := range collectedFields {
  9. for _, field := range fields {
  10. if collectedField.Name == field {
  11. return true
  12. }
  13. }
  14. }
  15. return false
  16. }