diff options
author | Michael Muré <batolettre@gmail.com> | 2018-07-19 14:15:50 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-07-19 14:15:50 +0200 |
commit | a2a50f3de0c428c5a61e6a449191be3c4ded86ac (patch) | |
tree | 5ecf4f5f1f26933b42a606b741963fa5f66c85aa /vendor/github.com/graphql-go/graphql/language/ast | |
parent | 25fb88d7497b00bbe3dda540efde22ffd3de6e49 (diff) | |
download | git-bug-a2a50f3de0c428c5a61e6a449191be3c4ded86ac.tar.gz |
webui: add a primitive graphql handler
Diffstat (limited to 'vendor/github.com/graphql-go/graphql/language/ast')
11 files changed, 1526 insertions, 0 deletions
diff --git a/vendor/github.com/graphql-go/graphql/language/ast/arguments.go b/vendor/github.com/graphql-go/graphql/language/ast/arguments.go new file mode 100644 index 00000000..5f7ef0d2 --- /dev/null +++ b/vendor/github.com/graphql-go/graphql/language/ast/arguments.go @@ -0,0 +1,33 @@ +package ast + +import ( + "github.com/graphql-go/graphql/language/kinds" +) + +// Argument implements Node +type Argument struct { + Kind string + Loc *Location + Name *Name + Value Value +} + +func NewArgument(arg *Argument) *Argument { + if arg == nil { + arg = &Argument{} + } + return &Argument{ + Kind: kinds.Argument, + Loc: arg.Loc, + Name: arg.Name, + Value: arg.Value, + } +} + +func (arg *Argument) GetKind() string { + return arg.Kind +} + +func (arg *Argument) GetLoc() *Location { + return arg.Loc +} diff --git a/vendor/github.com/graphql-go/graphql/language/ast/definitions.go b/vendor/github.com/graphql-go/graphql/language/ast/definitions.go new file mode 100644 index 00000000..cd527f0a --- /dev/null +++ b/vendor/github.com/graphql-go/graphql/language/ast/definitions.go @@ -0,0 +1,247 @@ +package ast + +import ( + "github.com/graphql-go/graphql/language/kinds" +) + +type Definition interface { + GetOperation() string + GetVariableDefinitions() []*VariableDefinition + GetSelectionSet() *SelectionSet + GetKind() string + GetLoc() *Location +} + +// Ensure that all definition types implements Definition interface +var _ Definition = (*OperationDefinition)(nil) +var _ Definition = (*FragmentDefinition)(nil) +var _ Definition = (TypeSystemDefinition)(nil) // experimental non-spec addition. + +// Note: subscription is an experimental non-spec addition. +const ( + OperationTypeQuery = "query" + OperationTypeMutation = "mutation" + OperationTypeSubscription = "subscription" +) + +// OperationDefinition implements Node, Definition +type OperationDefinition struct { + Kind string + Loc *Location + Operation string + Name *Name + VariableDefinitions []*VariableDefinition + Directives []*Directive + SelectionSet *SelectionSet +} + +func NewOperationDefinition(op *OperationDefinition) *OperationDefinition { + if op == nil { + op = &OperationDefinition{} + } + return &OperationDefinition{ + Kind: kinds.OperationDefinition, + Loc: op.Loc, + Operation: op.Operation, + Name: op.Name, + VariableDefinitions: op.VariableDefinitions, + Directives: op.Directives, + SelectionSet: op.SelectionSet, + } +} + +func (op *OperationDefinition) GetKind() string { + return op.Kind +} + +func (op *OperationDefinition) GetLoc() *Location { + return op.Loc +} + +func (op *OperationDefinition) GetOperation() string { + return op.Operation +} + +func (op *OperationDefinition) GetName() *Name { + return op.Name +} + +func (op *OperationDefinition) GetVariableDefinitions() []*VariableDefinition { + return op.VariableDefinitions +} + +func (op *OperationDefinition) GetDirectives() []*Directive { + return op.Directives +} + +func (op *OperationDefinition) GetSelectionSet() *SelectionSet { + return op.SelectionSet +} + +// FragmentDefinition implements Node, Definition +type FragmentDefinition struct { + Kind string + Loc *Location + Operation string + Name *Name + VariableDefinitions []*VariableDefinition + TypeCondition *Named + Directives []*Directive + SelectionSet *SelectionSet +} + +func NewFragmentDefinition(fd *FragmentDefinition) *FragmentDefinition { + if fd == nil { + fd = &FragmentDefinition{} + } + return &FragmentDefinition{ + Kind: kinds.FragmentDefinition, + Loc: fd.Loc, + Operation: fd.Operation, + Name: fd.Name, + VariableDefinitions: fd.VariableDefinitions, + TypeCondition: fd.TypeCondition, + Directives: fd.Directives, + SelectionSet: fd.SelectionSet, + } +} + +func (fd *FragmentDefinition) GetKind() string { + return fd.Kind +} + +func (fd *FragmentDefinition) GetLoc() *Location { + return fd.Loc +} + +func (fd *FragmentDefinition) GetOperation() string { + return fd.Operation +} + +func (fd *FragmentDefinition) GetName() *Name { + return fd.Name +} + +func (fd *FragmentDefinition) GetVariableDefinitions() []*VariableDefinition { + return fd.VariableDefinitions +} + +func (fd *FragmentDefinition) GetSelectionSet() *SelectionSet { + return fd.SelectionSet +} + +// VariableDefinition implements Node +type VariableDefinition struct { + Kind string + Loc *Location + Variable *Variable + Type Type + DefaultValue Value +} + +func NewVariableDefinition(vd *VariableDefinition) *VariableDefinition { + if vd == nil { + vd = &VariableDefinition{} + } + return &VariableDefinition{ + Kind: kinds.VariableDefinition, + Loc: vd.Loc, + Variable: vd.Variable, + Type: vd.Type, + DefaultValue: vd.DefaultValue, + } +} + +func (vd *VariableDefinition) GetKind() string { + return vd.Kind +} + +func (vd *VariableDefinition) GetLoc() *Location { + return vd.Loc +} + +// TypeExtensionDefinition implements Node, Definition +type TypeExtensionDefinition struct { + Kind string + Loc *Location + Definition *ObjectDefinition +} + +func NewTypeExtensionDefinition(def *TypeExtensionDefinition) *TypeExtensionDefinition { + if def == nil { + def = &TypeExtensionDefinition{} + } + return &TypeExtensionDefinition{ + Kind: kinds.TypeExtensionDefinition, + Loc: def.Loc, + Definition: def.Definition, + } +} + +func (def *TypeExtensionDefinition) GetKind() string { + return def.Kind +} + +func (def *TypeExtensionDefinition) GetLoc() *Location { + return def.Loc +} + +func (def *TypeExtensionDefinition) GetVariableDefinitions() []*VariableDefinition { + return []*VariableDefinition{} +} + +func (def *TypeExtensionDefinition) GetSelectionSet() *SelectionSet { + return &SelectionSet{} +} + +func (def *TypeExtensionDefinition) GetOperation() string { + return "" +} + +// DirectiveDefinition implements Node, Definition +type DirectiveDefinition struct { + Kind string + Loc *Location + Name *Name + Description *StringValue + Arguments []*InputValueDefinition + Locations []*Name +} + +func NewDirectiveDefinition(def *DirectiveDefinition) *DirectiveDefinition { + if def == nil { + def = &DirectiveDefinition{} + } + return &DirectiveDefinition{ + Kind: kinds.DirectiveDefinition, + Loc: def.Loc, + Name: def.Name, + Description: def.Description, + Arguments: def.Arguments, + Locations: def.Locations, + } +} + +func (def *DirectiveDefinition) GetKind() string { + return def.Kind +} + +func (def *DirectiveDefinition) GetLoc() *Location { + return def.Loc +} + +func (def *DirectiveDefinition) GetVariableDefinitions() []*VariableDefinition { + return []*VariableDefinition{} +} + +func (def *DirectiveDefinition) GetSelectionSet() *SelectionSet { + return &SelectionSet{} +} + +func (def *DirectiveDefinition) GetOperation() string { + return "" +} + +func (def *DirectiveDefinition) GetDescription() *StringValue { + return def.Description +} diff --git a/vendor/github.com/graphql-go/graphql/language/ast/directives.go b/vendor/github.com/graphql-go/graphql/language/ast/directives.go new file mode 100644 index 00000000..0c8a8c0e --- /dev/null +++ b/vendor/github.com/graphql-go/graphql/language/ast/directives.go @@ -0,0 +1,33 @@ +package ast + +import ( + "github.com/graphql-go/graphql/language/kinds" +) + +// Directive implements Node +type Directive struct { + Kind string + Loc *Location + Name *Name + Arguments []*Argument +} + +func NewDirective(dir *Directive) *Directive { + if dir == nil { + dir = &Directive{} + } + return &Directive{ + Kind: kinds.Directive, + Loc: dir.Loc, + Name: dir.Name, + Arguments: dir.Arguments, + } +} + +func (dir *Directive) GetKind() string { + return dir.Kind +} + +func (dir *Directive) GetLoc() *Location { + return dir.Loc +} diff --git a/vendor/github.com/graphql-go/graphql/language/ast/document.go b/vendor/github.com/graphql-go/graphql/language/ast/document.go new file mode 100644 index 00000000..dcb67034 --- /dev/null +++ b/vendor/github.com/graphql-go/graphql/language/ast/document.go @@ -0,0 +1,31 @@ +package ast + +import ( + "github.com/graphql-go/graphql/language/kinds" +) + +// Document implements Node +type Document struct { + Kind string + Loc *Location + Definitions []Node +} + +func NewDocument(d *Document) *Document { + if d == nil { + d = &Document{} + } + return &Document{ + Kind: kinds.Document, + Loc: d.Loc, + Definitions: d.Definitions, + } +} + +func (node *Document) GetKind() string { + return node.Kind +} + +func (node *Document) GetLoc() *Location { + return node.Loc +} diff --git a/vendor/github.com/graphql-go/graphql/language/ast/location.go b/vendor/github.com/graphql-go/graphql/language/ast/location.go new file mode 100644 index 00000000..266dc847 --- /dev/null +++ b/vendor/github.com/graphql-go/graphql/language/ast/location.go @@ -0,0 +1,22 @@ +package ast + +import ( + "github.com/graphql-go/graphql/language/source" +) + +type Location struct { + Start int + End int + Source *source.Source +} + +func NewLocation(loc *Location) *Location { + if loc == nil { + loc = &Location{} + } + return &Location{ + Start: loc.Start, + End: loc.End, + Source: loc.Source, + } +} diff --git a/vendor/github.com/graphql-go/graphql/language/ast/name.go b/vendor/github.com/graphql-go/graphql/language/ast/name.go new file mode 100644 index 00000000..00fddbcd --- /dev/null +++ b/vendor/github.com/graphql-go/graphql/language/ast/name.go @@ -0,0 +1,31 @@ +package ast + +import ( + "github.com/graphql-go/graphql/language/kinds" +) + +// Name implements Node +type Name struct { + Kind string + Loc *Location + Value string +} + +func NewName(node *Name) *Name { + if node == nil { + node = &Name{} + } + return &Name{ + Kind: kinds.Name, + Value: node.Value, + Loc: node.Loc, + } +} + +func (node *Name) GetKind() string { + return node.Kind +} + +func (node *Name) GetLoc() *Location { + return node.Loc +} diff --git a/vendor/github.com/graphql-go/graphql/language/ast/node.go b/vendor/github.com/graphql-go/graphql/language/ast/node.go new file mode 100644 index 00000000..cd63a0fc --- /dev/null +++ b/vendor/github.com/graphql-go/graphql/language/ast/node.go @@ -0,0 +1,45 @@ +package ast + +type Node interface { + GetKind() string + GetLoc() *Location +} + +// The list of all possible AST node graphql. +// Ensure that all node types implements Node interface +var _ Node = (*Name)(nil) +var _ Node = (*Document)(nil) +var _ Node = (*OperationDefinition)(nil) +var _ Node = (*VariableDefinition)(nil) +var _ Node = (*Variable)(nil) +var _ Node = (*SelectionSet)(nil) +var _ Node = (*Field)(nil) +var _ Node = (*Argument)(nil) +var _ Node = (*FragmentSpread)(nil) +var _ Node = (*InlineFragment)(nil) +var _ Node = (*FragmentDefinition)(nil) +var _ Node = (*IntValue)(nil) +var _ Node = (*FloatValue)(nil) +var _ Node = (*StringValue)(nil) +var _ Node = (*BooleanValue)(nil) +var _ Node = (*EnumValue)(nil) +var _ Node = (*ListValue)(nil) +var _ Node = (*ObjectValue)(nil) +var _ Node = (*ObjectField)(nil) +var _ Node = (*Directive)(nil) +var _ Node = (*Named)(nil) +var _ Node = (*List)(nil) +var _ Node = (*NonNull)(nil) +var _ Node = (*SchemaDefinition)(nil) +var _ Node = (*OperationTypeDefinition)(nil) +var _ Node = (*ScalarDefinition)(nil) +var _ Node = (*ObjectDefinition)(nil) +var _ Node = (*FieldDefinition)(nil) +var _ Node = (*InputValueDefinition)(nil) +var _ Node = (*InterfaceDefinition)(nil) +var _ Node = (*UnionDefinition)(nil) +var _ Node = (*EnumDefinition)(nil) +var _ Node = (*EnumValueDefinition)(nil) +var _ Node = (*InputObjectDefinition)(nil) +var _ Node = (*TypeExtensionDefinition)(nil) +var _ Node = (*DirectiveDefinition)(nil) diff --git a/vendor/github.com/graphql-go/graphql/language/ast/selections.go b/vendor/github.com/graphql-go/graphql/language/ast/selections.go new file mode 100644 index 00000000..0dc0ea12 --- /dev/null +++ b/vendor/github.com/graphql-go/graphql/language/ast/selections.go @@ -0,0 +1,144 @@ +package ast + +import ( + "github.com/graphql-go/graphql/language/kinds" +) + +type Selection interface { + GetSelectionSet() *SelectionSet +} + +// Ensure that all definition types implements Selection interface +var _ Selection = (*Field)(nil) +var _ Selection = (*FragmentSpread)(nil) +var _ Selection = (*InlineFragment)(nil) + +// Field implements Node, Selection +type Field struct { + Kind string + Loc *Location + Alias *Name + Name *Name + Arguments []*Argument + Directives []*Directive + SelectionSet *SelectionSet +} + +func NewField(f *Field) *Field { + if f == nil { + f = &Field{} + } + return &Field{ + Kind: kinds.Field, + Loc: f.Loc, + Alias: f.Alias, + Name: f.Name, + Arguments: f.Arguments, + Directives: f.Directives, + SelectionSet: f.SelectionSet, + } +} + +func (f *Field) GetKind() string { + return f.Kind +} + +func (f *Field) GetLoc() *Location { + return f.Loc +} + +func (f *Field) GetSelectionSet() *SelectionSet { + return f.SelectionSet +} + +// FragmentSpread implements Node, Selection +type FragmentSpread struct { + Kind string + Loc *Location + Name *Name + Directives []*Directive +} + +func NewFragmentSpread(fs *FragmentSpread) *FragmentSpread { + if fs == nil { + fs = &FragmentSpread{} + } + return &FragmentSpread{ + Kind: kinds.FragmentSpread, + Loc: fs.Loc, + Name: fs.Name, + Directives: fs.Directives, + } +} + +func (fs *FragmentSpread) GetKind() string { + return fs.Kind +} + +func (fs *FragmentSpread) GetLoc() *Location { + return fs.Loc +} + +func (fs *FragmentSpread) GetSelectionSet() *SelectionSet { + return nil +} + +// InlineFragment implements Node, Selection +type InlineFragment struct { + Kind string + Loc *Location + TypeCondition *Named + Directives []*Directive + SelectionSet *SelectionSet +} + +func NewInlineFragment(f *InlineFragment) *InlineFragment { + if f == nil { + f = &InlineFragment{} + } + return &InlineFragment{ + Kind: kinds.InlineFragment, + Loc: f.Loc, + TypeCondition: f.TypeCondition, + Directives: f.Directives, + SelectionSet: f.SelectionSet, + } +} + +func (f *InlineFragment) GetKind() string { + return f.Kind +} + +func (f *InlineFragment) GetLoc() *Location { + return f.Loc +} + +func (f *InlineFragment) GetSelectionSet() *SelectionSet { + return f.SelectionSet +} + +// SelectionSet implements Node +type SelectionSet struct { + Kind string + Loc *Location + Selections []Selection +} + +func NewSelectionSet(ss *SelectionSet) *SelectionSet { + if ss == nil { + ss = &SelectionSet{} + } + return &SelectionSet{ + Kind: kinds.SelectionSet, + Loc: ss.Loc, + Selections: ss.Selections, + } +} + +func (ss *SelectionSet) GetKind() string { + return ss.Kind +} + +func (ss *SelectionSet) GetLoc() *Location { + return ss.Loc +} diff --git a/vendor/github.com/graphql-go/graphql/language/ast/type_definitions.go b/vendor/github.com/graphql-go/graphql/language/ast/type_definitions.go new file mode 100644 index 00000000..aefa70ed --- /dev/null +++ b/vendor/github.com/graphql-go/graphql/language/ast/type_definitions.go @@ -0,0 +1,529 @@ +package ast + +import ( + "github.com/graphql-go/graphql/language/kinds" +) + +// DescribableNode are nodes that have descriptions associated with them. +type DescribableNode interface { + GetDescription() *StringValue +} + +type TypeDefinition interface { + DescribableNode + GetOperation() string + GetVariableDefinitions() []*VariableDefinition + GetSelectionSet() *SelectionSet + GetKind() string + GetLoc() *Location +} + +var _ TypeDefinition = (*ScalarDefinition)(nil) +var _ TypeDefinition = (*ObjectDefinition)(nil) +var _ TypeDefinition = (*InterfaceDefinition)(nil) +var _ TypeDefinition = (*UnionDefinition)(nil) +var _ TypeDefinition = (*EnumDefinition)(nil) +var _ TypeDefinition = (*InputObjectDefinition)(nil) + +type TypeSystemDefinition interface { + GetOperation() string + GetVariableDefinitions() []*VariableDefinition + GetSelectionSet() *SelectionSet + GetKind() string + GetLoc() *Location +} + +var _ TypeSystemDefinition = (*SchemaDefinition)(nil) +var _ TypeSystemDefinition = (TypeDefinition)(nil) +var _ TypeSystemDefinition = (*TypeExtensionDefinition)(nil) +var _ TypeSystemDefinition = (*DirectiveDefinition)(nil) + +// SchemaDefinition implements Node, Definition +type SchemaDefinition struct { + Kind string + Loc *Location + Directives []*Directive + OperationTypes []*OperationTypeDefinition +} + +func NewSchemaDefinition(def *SchemaDefinition) *SchemaDefinition { + if def == nil { + def = &SchemaDefinition{} + } + return &SchemaDefinition{ + Kind: kinds.SchemaDefinition, + Loc: def.Loc, + Directives: def.Directives, + OperationTypes: def.OperationTypes, + } +} + +func (def *SchemaDefinition) GetKind() string { + return def.Kind +} + +func (def *SchemaDefinition) GetLoc() *Location { + return def.Loc +} + +func (def *SchemaDefinition) GetVariableDefinitions() []*VariableDefinition { + return []*VariableDefinition{} +} + +func (def *SchemaDefinition) GetSelectionSet() *SelectionSet { + return &SelectionSet{} +} + +func (def *SchemaDefinition) GetOperation() string { + return "" +} + +// OperationTypeDefinition implements Node, Definition +type OperationTypeDefinition struct { + Kind string + Loc *Location + Operation string + Type *Named +} + +func NewOperationTypeDefinition(def *OperationTypeDefinition) *OperationTypeDefinition { + if def == nil { + def = &OperationTypeDefinition{} + } + return &OperationTypeDefinition{ + Kind: kinds.OperationTypeDefinition, + Loc: def.Loc, + Operation: def.Operation, + Type: def.Type, + } +} + +func (def *OperationTypeDefinition) GetKind() string { + return def.Kind +} + +func (def *OperationTypeDefinition) GetLoc() *Location { + return def.Loc +} + +// ScalarDefinition implements Node, Definition +type ScalarDefinition struct { + Kind string + Loc *Location + Description *StringValue + Name *Name + Directives []*Directive +} + +func NewScalarDefinition(def *ScalarDefinition) *ScalarDefinition { + if def == nil { + def = &ScalarDefinition{} + } + return &ScalarDefinition{ + Kind: kinds.ScalarDefinition, + Loc: def.Loc, + Description: def.Description, + Name: def.Name, + Directives: def.Directives, + } +} + +func (def *ScalarDefinition) GetKind() string { + return def.Kind +} + +func (def *ScalarDefinition) GetLoc() *Location { + return def.Loc +} + +func (def *ScalarDefinition) GetName() *Name { + return def.Name +} + +func (def *ScalarDefinition) GetVariableDefinitions() []*VariableDefinition { + return []*VariableDefinition{} +} + +func (def *ScalarDefinition) GetSelectionSet() *SelectionSet { + return &SelectionSet{} +} + +func (def *ScalarDefinition) GetOperation() string { + return "" +} + +func (def *ScalarDefinition) GetDescription() *StringValue { + return def.Description +} + +// ObjectDefinition implements Node, Definition +type ObjectDefinition struct { + Kind string + Loc *Location + Name *Name + Description *StringValue + Interfaces []*Named + Directives []*Directive + Fields []*FieldDefinition +} + +func NewObjectDefinition(def *ObjectDefinition) *ObjectDefinition { + if def == nil { + def = &ObjectDefinition{} + } + return &ObjectDefinition{ + Kind: kinds.ObjectDefinition, + Loc: def.Loc, + Name: def.Name, + Description: def.Description, + Interfaces: def.Interfaces, + Directives: def.Directives, + Fields: def.Fields, + } +} + +func (def *ObjectDefinition) GetKind() string { + return def.Kind +} + +func (def *ObjectDefinition) GetLoc() *Location { + return def.Loc +} + +func (def *ObjectDefinition) GetName() *Name { + return def.Name +} + +func (def *ObjectDefinition) GetVariableDefinitions() []*VariableDefinition { + return []*VariableDefinition{} +} + +func (def *ObjectDefinition) GetSelectionSet() *SelectionSet { + return &SelectionSet{} +} + +func (def *ObjectDefinition) GetOperation() string { + return "" +} + +func (def *ObjectDefinition) GetDescription() *StringValue { + return def.Description +} + +// FieldDefinition implements Node +type FieldDefinition struct { + Kind string + Loc *Location + Name *Name + Description *StringValue + Arguments []*InputValueDefinition + Type Type + Directives []*Directive +} + +func NewFieldDefinition(def *FieldDefinition) *FieldDefinition { + if def == nil { + def = &FieldDefinition{} + } + return &FieldDefinition{ + Kind: kinds.FieldDefinition, + Loc: def.Loc, + Name: def.Name, + Description: def.Description, + Arguments: def.Arguments, + Type: def.Type, + Directives: def.Directives, + } +} + +func (def *FieldDefinition) GetKind() string { + return def.Kind +} + +func (def *FieldDefinition) GetLoc() *Location { + return def.Loc +} + +func (def *FieldDefinition) GetDescription() *StringValue { + return def.Description +} + +// InputValueDefinition implements Node +type InputValueDefinition struct { + Kind string + Loc *Location + Name *Name + Description *StringValue + Type Type + DefaultValue Value + Directives []*Directive +} + +func NewInputValueDefinition(def *InputValueDefinition) *InputValueDefinition { + if def == nil { + def = &InputValueDefinition{} + } + return &InputValueDefinition{ + Kind: kinds.InputValueDefinition, + Loc: def.Loc, + Name: def.Name, + Description: def.Description, + Type: def.Type, + DefaultValue: def.DefaultValue, + Directives: def.Directives, + } +} + +func (def *InputValueDefinition) GetKind() string { + return def.Kind +} + +func (def *InputValueDefinition) GetLoc() *Location { + return def.Loc +} + +func (def *InputValueDefinition) GetDescription() *StringValue { + return def.Description +} + +// InterfaceDefinition implements Node, Definition +type InterfaceDefinition struct { + Kind string + Loc *Location + Name *Name + Description *StringValue + Directives []*Directive + Fields []*FieldDefinition +} + +func NewInterfaceDefinition(def *InterfaceDefinition) *InterfaceDefinition { + if def == nil { + def = &InterfaceDefinition{} + } + return &InterfaceDefinition{ + Kind: kinds.InterfaceDefinition, + Loc: def.Loc, + Name: def.Name, + Description: def.Description, + Directives: def.Directives, + Fields: def.Fields, + } +} + +func (def *InterfaceDefinition) GetKind() string { + return def.Kind +} + +func (def *InterfaceDefinition) GetLoc() *Location { + return def.Loc +} + +func (def *InterfaceDefinition) GetName() *Name { + return def.Name +} + +func (def *InterfaceDefinition) GetVariableDefinitions() []*VariableDefinition { + return []*VariableDefinition{} +} + +func (def *InterfaceDefinition) GetSelectionSet() *SelectionSet { + return &SelectionSet{} +} + +func (def *InterfaceDefinition) GetOperation() string { + return "" +} + +func (def *InterfaceDefinition) GetDescription() *StringValue { + return def.Description +} + +// UnionDefinition implements Node, Definition +type UnionDefinition struct { + Kind string + Loc *Location + Name *Name + Description *StringValue + Directives []*Directive + Types []*Named +} + +func NewUnionDefinition(def *UnionDefinition) *UnionDefinition { + if def == nil { + def = &UnionDefinition{} + } + return &UnionDefinition{ + Kind: kinds.UnionDefinition, + Loc: def.Loc, + Name: def.Name, + Description: def.Description, + Directives: def.Directives, + Types: def.Types, + } +} + +func (def *UnionDefinition) GetKind() string { + return def.Kind +} + +func (def *UnionDefinition) GetLoc() *Location { + return def.Loc +} + +func (def *UnionDefinition) GetName() *Name { + return def.Name +} + +func (def *UnionDefinition) GetVariableDefinitions() []*VariableDefinition { + return []*VariableDefinition{} +} + +func (def *UnionDefinition) GetSelectionSet() *SelectionSet { + return &SelectionSet{} +} + +func (def *UnionDefinition) GetOperation() string { + return "" +} + +func (def *UnionDefinition) GetDescription() *StringValue { + return def.Description +} + +// EnumDefinition implements Node, Definition +type EnumDefinition struct { + Kind string + Loc *Location + Name *Name + Description *StringValue + Directives []*Directive + Values []*EnumValueDefinition +} + +func NewEnumDefinition(def *EnumDefinition) *EnumDefinition { + if def == nil { + def = &EnumDefinition{} + } + return &EnumDefinition{ + Kind: kinds.EnumDefinition, + Loc: def.Loc, + Name: def.Name, + Description: def.Description, + Directives: def.Directives, + Values: def.Values, + } +} + +func (def *EnumDefinition) GetKind() string { + return def.Kind +} + +func (def *EnumDefinition) GetLoc() *Location { + return def.Loc +} + +func (def *EnumDefinition) GetName() *Name { + return def.Name +} + +func (def *EnumDefinition) GetVariableDefinitions() []*VariableDefinition { + return []*VariableDefinition{} +} + +func (def *EnumDefinition) GetSelectionSet() *SelectionSet { + return &SelectionSet{} +} + +func (def *EnumDefinition) GetOperation() string { + return "" +} + +func (def *EnumDefinition) GetDescription() *StringValue { + return def.Description +} + +// EnumValueDefinition implements Node, Definition +type EnumValueDefinition struct { + Kind string + Loc *Location + Name *Name + Description *StringValue + Directives []*Directive +} + +func NewEnumValueDefinition(def *EnumValueDefinition) *EnumValueDefinition { + if def == nil { + def = &EnumValueDefinition{} + } + return &EnumValueDefinition{ + Kind: kinds.EnumValueDefinition, + Loc: def.Loc, + Name: def.Name, + Description: def.Description, + Directives: def.Directives, + } +} + +func (def *EnumValueDefinition) GetKind() string { + return def.Kind +} + +func (def *EnumValueDefinition) GetLoc() *Location { + return def.Loc +} + +func (def *EnumValueDefinition) GetDescription() *StringValue { + return def.Description +} + +// InputObjectDefinition implements Node, Definition +type InputObjectDefinition struct { + Kind string + Loc *Location + Name *Name + Description *StringValue + Directives []*Directive + Fields []*InputValueDefinition +} + +func NewInputObjectDefinition(def *InputObjectDefinition) *InputObjectDefinition { + if def == nil { + def = &InputObjectDefinition{} + } + return &InputObjectDefinition{ + Kind: kinds.InputObjectDefinition, + Loc: def.Loc, + Name: def.Name, + Description: def.Description, + Directives: def.Directives, + Fields: def.Fields, + } +} + +func (def *InputObjectDefinition) GetKind() string { + return def.Kind +} + +func (def *InputObjectDefinition) GetLoc() *Location { + return def.Loc +} + +func (def *InputObjectDefinition) GetName() *Name { + return def.Name +} + +func (def *InputObjectDefinition) GetVariableDefinitions() []*VariableDefinition { + return []*VariableDefinition{} +} + +func (def *InputObjectDefinition) GetSelectionSet() *SelectionSet { + return &SelectionSet{} +} + +func (def *InputObjectDefinition) GetOperation() string { + return "" +} + +func (def *InputObjectDefinition) GetDescription() *StringValue { + return def.Description +} diff --git a/vendor/github.com/graphql-go/graphql/language/ast/types.go b/vendor/github.com/graphql-go/graphql/language/ast/types.go new file mode 100644 index 00000000..27f00997 --- /dev/null +++ b/vendor/github.com/graphql-go/graphql/language/ast/types.go @@ -0,0 +1,106 @@ +package ast + +import ( + "github.com/graphql-go/graphql/language/kinds" +) + +type Type interface { + GetKind() string + GetLoc() *Location + String() string +} + +// Ensure that all value types implements Value interface +var _ Type = (*Named)(nil) +var _ Type = (*List)(nil) +var _ Type = (*NonNull)(nil) + +// Named implements Node, Type +type Named struct { + Kind string + Loc *Location + Name *Name +} + +func NewNamed(t *Named) *Named { + if t == nil { + t = &Named{} + } + return &Named{ + Kind: kinds.Named, + Loc: t.Loc, + Name: t.Name, + } +} + +func (t *Named) GetKind() string { + return t.Kind +} + +func (t *Named) GetLoc() *Location { + return t.Loc +} + +func (t *Named) String() string { + return t.GetKind() +} + +// List implements Node, Type +type List struct { + Kind string + Loc *Location + Type Type +} + +func NewList(t *List) *List { + if t == nil { + t = &List{} + } + return &List{ + Kind: kinds.List, + Loc: t.Loc, + Type: t.Type, + } +} + +func (t *List) GetKind() string { + return t.Kind +} + +func (t *List) GetLoc() *Location { + return t.Loc +} + +func (t *List) String() string { + return t.GetKind() +} + +// NonNull implements Node, Type +type NonNull struct { + Kind string + Loc *Location + Type Type +} + +func NewNonNull(t *NonNull) *NonNull { + if t == nil { + t = &NonNull{} + } + return &NonNull{ + Kind: kinds.NonNull, + Loc: t.Loc, + Type: t.Type, + } +} + +func (t *NonNull) GetKind() string { + return t.Kind +} + +func (t *NonNull) GetLoc() *Location { + return t.Loc +} + +func (t *NonNull) String() string { + return t.GetKind() +} diff --git a/vendor/github.com/graphql-go/graphql/language/ast/values.go b/vendor/github.com/graphql-go/graphql/language/ast/values.go new file mode 100644 index 00000000..67912bdc --- /dev/null +++ b/vendor/github.com/graphql-go/graphql/language/ast/values.go @@ -0,0 +1,305 @@ +package ast + +import ( + "github.com/graphql-go/graphql/language/kinds" +) + +type Value interface { + GetValue() interface{} + GetKind() string + GetLoc() *Location +} + +// Ensure that all value types implements Value interface +var _ Value = (*Variable)(nil) +var _ Value = (*IntValue)(nil) +var _ Value = (*FloatValue)(nil) +var _ Value = (*StringValue)(nil) +var _ Value = (*BooleanValue)(nil) +var _ Value = (*EnumValue)(nil) +var _ Value = (*ListValue)(nil) +var _ Value = (*ObjectValue)(nil) + +// Variable implements Node, Value +type Variable struct { + Kind string + Loc *Location + Name *Name +} + +func NewVariable(v *Variable) *Variable { + if v == nil { + v = &Variable{} + } + return &Variable{ + Kind: kinds.Variable, + Loc: v.Loc, + Name: v.Name, + } +} + +func (v *Variable) GetKind() string { + return v.Kind +} + +func (v *Variable) GetLoc() *Location { + return v.Loc +} + +// GetValue alias to Variable.GetName() +func (v *Variable) GetValue() interface{} { + return v.GetName() +} + +func (v *Variable) GetName() interface{} { + return v.Name +} + +// IntValue implements Node, Value +type IntValue struct { + Kind string + Loc *Location + Value string +} + +func NewIntValue(v *IntValue) *IntValue { + if v == nil { + v = &IntValue{} + } + return &IntValue{ + Kind: kinds.IntValue, + Loc: v.Loc, + Value: v.Value, + } +} + +func (v *IntValue) GetKind() string { + return v.Kind +} + +func (v *IntValue) GetLoc() *Location { + return v.Loc +} + +func (v *IntValue) GetValue() interface{} { + return v.Value +} + +// FloatValue implements Node, Value +type FloatValue struct { + Kind string + Loc *Location + Value string +} + +func NewFloatValue(v *FloatValue) *FloatValue { + if v == nil { + v = &FloatValue{} + } + return &FloatValue{ + Kind: kinds.FloatValue, + Loc: v.Loc, + Value: v.Value, + } +} + +func (v *FloatValue) GetKind() string { + return v.Kind +} + +func (v *FloatValue) GetLoc() *Location { + return v.Loc +} + +func (v *FloatValue) GetValue() interface{} { + return v.Value +} + +// StringValue implements Node, Value +type StringValue struct { + Kind string + Loc *Location + Value string +} + +func NewStringValue(v *StringValue) *StringValue { + if v == nil { + v = &StringValue{} + } + return &StringValue{ + Kind: kinds.StringValue, + Loc: v.Loc, + Value: v.Value, + } +} + +func (v *StringValue) GetKind() string { + return v.Kind +} + +func (v *StringValue) GetLoc() *Location { + return v.Loc +} + +func (v *StringValue) GetValue() interface{} { + return v.Value +} + +// BooleanValue implements Node, Value +type BooleanValue struct { + Kind string + Loc *Location + Value bool +} + +func NewBooleanValue(v *BooleanValue) *BooleanValue { + if v == nil { + v = &BooleanValue{} + } + return &BooleanValue{ + Kind: kinds.BooleanValue, + Loc: v.Loc, + Value: v.Value, + } +} + +func (v *BooleanValue) GetKind() string { + return v.Kind +} + +func (v *BooleanValue) GetLoc() *Location { + return v.Loc +} + +func (v *BooleanValue) GetValue() interface{} { + return v.Value +} + +// EnumValue implements Node, Value +type EnumValue struct { + Kind string + Loc *Location + Value string +} + +func NewEnumValue(v *EnumValue) *EnumValue { + if v == nil { + v = &EnumValue{} + } + return &EnumValue{ + Kind: kinds.EnumValue, + Loc: v.Loc, + Value: v.Value, + } +} + +func (v *EnumValue) GetKind() string { + return v.Kind +} + +func (v *EnumValue) GetLoc() *Location { + return v.Loc +} + +func (v *EnumValue) GetValue() interface{} { + return v.Value +} + +// ListValue implements Node, Value +type ListValue struct { + Kind string + Loc *Location + Values []Value +} + +func NewListValue(v *ListValue) *ListValue { + if v == nil { + v = &ListValue{} + } + return &ListValue{ + Kind: kinds.ListValue, + Loc: v.Loc, + Values: v.Values, + } +} + +func (v *ListValue) GetKind() string { + return v.Kind +} + +func (v *ListValue) GetLoc() *Location { + return v.Loc +} + +// GetValue alias to ListValue.GetValues() +func (v *ListValue) GetValue() interface{} { + return v.GetValues() +} + +func (v *ListValue) GetValues() interface{} { + // TODO: verify ObjectValue.GetValue() + return v.Values +} + +// ObjectValue implements Node, Value +type ObjectValue struct { + Kind string + Loc *Location + Fields []*ObjectField +} + +func NewObjectValue(v *ObjectValue) *ObjectValue { + if v == nil { + v = &ObjectValue{} + } + return &ObjectValue{ + Kind: kinds.ObjectValue, + Loc: v.Loc, + Fields: v.Fields, + } +} + +func (v *ObjectValue) GetKind() string { + return v.Kind +} + +func (v *ObjectValue) GetLoc() *Location { + return v.Loc +} + +func (v *ObjectValue) GetValue() interface{} { + // TODO: verify ObjectValue.GetValue() + return v.Fields +} + +// ObjectField implements Node, Value +type ObjectField struct { + Kind string + Name *Name + Loc *Location + Value Value +} + +func NewObjectField(f *ObjectField) *ObjectField { + if f == nil { + f = &ObjectField{} + } + return &ObjectField{ + Kind: kinds.ObjectField, + Loc: f.Loc, + Name: f.Name, + Value: f.Value, + } +} + +func (f *ObjectField) GetKind() string { + return f.Kind +} + +func (f *ObjectField) GetLoc() *Location { + return f.Loc +} + +func (f *ObjectField) GetValue() interface{} { + return f.Value +} |