aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/vektah/gqlparser/ast/type.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/vektah/gqlparser/ast/type.go')
-rw-r--r--vendor/github.com/vektah/gqlparser/ast/type.go68
1 files changed, 0 insertions, 68 deletions
diff --git a/vendor/github.com/vektah/gqlparser/ast/type.go b/vendor/github.com/vektah/gqlparser/ast/type.go
deleted file mode 100644
index 9577fdb4..00000000
--- a/vendor/github.com/vektah/gqlparser/ast/type.go
+++ /dev/null
@@ -1,68 +0,0 @@
-package ast
-
-func NonNullNamedType(named string, pos *Position) *Type {
- return &Type{NamedType: named, NonNull: true, Position: pos}
-}
-
-func NamedType(named string, pos *Position) *Type {
- return &Type{NamedType: named, NonNull: false, Position: pos}
-}
-
-func NonNullListType(elem *Type, pos *Position) *Type {
- return &Type{Elem: elem, NonNull: true, Position: pos}
-}
-
-func ListType(elem *Type, pos *Position) *Type {
- return &Type{Elem: elem, NonNull: false, Position: pos}
-}
-
-type Type struct {
- NamedType string
- Elem *Type
- NonNull bool
- Position *Position `dump:"-"`
-}
-
-func (t *Type) Name() string {
- if t.NamedType != "" {
- return t.NamedType
- }
-
- return t.Elem.Name()
-}
-
-func (t *Type) String() string {
- nn := ""
- if t.NonNull {
- nn = "!"
- }
- if t.NamedType != "" {
- return t.NamedType + nn
- }
-
- return "[" + t.Elem.String() + "]" + nn
-}
-
-func (t *Type) IsCompatible(other *Type) bool {
- if t.NamedType != other.NamedType {
- return false
- }
-
- if t.Elem != nil && other.Elem == nil {
- return false
- }
-
- if t.Elem != nil && !t.Elem.IsCompatible(other.Elem) {
- return false
- }
-
- if other.NonNull {
- return t.NonNull
- }
-
- return true
-}
-
-func (v *Type) Dump() string {
- return v.String()
-}