Files
server/graph/graphutil/fields.go
T
2020-05-08 15:54:40 +02:00

20 lines
388 B
Go

package graphutil
import (
"context"
"github.com/99designs/gqlgen/graphql"
)
func SelectsAnyField(ctx context.Context, fields ...string) bool {
collectedFields := graphql.CollectFieldsCtx(ctx, []string{"description"})
for _, collectedField := range collectedFields {
for _, field := range fields {
if collectedField.Name == field {
return true
}
}
}
return false
}