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
19 lines
388 B
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
|
|
}
|