Basic API works.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user