Files
kubesphere/vendor/github.com/open-policy-agent/opa/internal/gqlparser/ast/directive.go
hongzhouzi ef03b1e3df Upgrade dependent version: github.com/open-policy-agent/opa (#5315)
Upgrade dependent version: github.com/open-policy-agent/opa v0.18.0 -> v0.45.0

Signed-off-by: hongzhouzi <hongzhouzi@kubesphere.io>

Signed-off-by: hongzhouzi <hongzhouzi@kubesphere.io>
2022-10-31 10:58:55 +08:00

44 lines
1.6 KiB
Go

package ast
type DirectiveLocation string
const (
// Executable
LocationQuery DirectiveLocation = `QUERY`
LocationMutation DirectiveLocation = `MUTATION`
LocationSubscription DirectiveLocation = `SUBSCRIPTION`
LocationField DirectiveLocation = `FIELD`
LocationFragmentDefinition DirectiveLocation = `FRAGMENT_DEFINITION`
LocationFragmentSpread DirectiveLocation = `FRAGMENT_SPREAD`
LocationInlineFragment DirectiveLocation = `INLINE_FRAGMENT`
// Type System
LocationSchema DirectiveLocation = `SCHEMA`
LocationScalar DirectiveLocation = `SCALAR`
LocationObject DirectiveLocation = `OBJECT`
LocationFieldDefinition DirectiveLocation = `FIELD_DEFINITION`
LocationArgumentDefinition DirectiveLocation = `ARGUMENT_DEFINITION`
LocationInterface DirectiveLocation = `INTERFACE`
LocationUnion DirectiveLocation = `UNION`
LocationEnum DirectiveLocation = `ENUM`
LocationEnumValue DirectiveLocation = `ENUM_VALUE`
LocationInputObject DirectiveLocation = `INPUT_OBJECT`
LocationInputFieldDefinition DirectiveLocation = `INPUT_FIELD_DEFINITION`
LocationVariableDefinition DirectiveLocation = `VARIABLE_DEFINITION`
)
type Directive struct {
Name string
Arguments ArgumentList
Position *Position `dump:"-"`
// Requires validation
ParentDefinition *Definition
Definition *DirectiveDefinition
Location DirectiveLocation
}
func (d *Directive) ArgumentMap(vars map[string]interface{}) map[string]interface{} {
return arg2map(d.Definition.Arguments, d.Arguments, vars)
}