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