/
types.go
45 lines (39 loc) · 884 Bytes
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package graphql
// Kind is an unsigned 16-bit integer used for defining kinds.
type Kind uint16
const (
// EnumKind identifies enum config
EnumKind Kind = iota
// InputKind identifies input object config
InputKind
// InterfaceKind identifies interface config
InterfaceKind
// ObjectKind identifies object config
ObjectKind
// ScalarKind identifies scalar config
ScalarKind
// SchemaKind identifies schema config
SchemaKind
// UnionKind identifies union config
UnionKind
)
// Type represents base description of GraphQL type
type Type struct {
name string
kind Kind
}
// NewType returns new instance of Type
func NewType(name string, kind Kind) Type {
return Type{
name: name,
kind: kind,
}
}
// Name of GraphQL type represented
func (t Type) Name() string {
return t.name
}
// Kind of GraphQL type represented
func (t Type) Kind() Kind {
return t.kind
}