forked from infiotinc/gqlgenc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
type.go
80 lines (69 loc) · 1.64 KB
/
type.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package introspection
type TypeKind string
const (
TypeKindScalar TypeKind = "SCALAR"
TypeKindObject TypeKind = "OBJECT"
TypeKindInterface TypeKind = "INTERFACE"
TypeKindUnion TypeKind = "UNION"
TypeKindEnum TypeKind = "ENUM"
TypeKindInputObject TypeKind = "INPUT_OBJECT"
TypeKindList TypeKind = "LIST"
TypeKindNonNull TypeKind = "NON_NULL"
)
type FullTypes []*FullType
func (fs FullTypes) NameMap() map[string]*FullType {
typeMap := make(map[string]*FullType)
for _, typ := range fs {
typeMap[*typ.Name] = typ
}
return typeMap
}
type FullType struct {
Kind TypeKind
Name *string
Description *string
Fields []*FieldValue
InputFields []*InputValue
Interfaces []*TypeRef
EnumValues []*struct {
Name string
Description *string
IsDeprecated bool
DeprecationReason *string
}
PossibleTypes []*TypeRef
}
type FieldValue struct {
Name string
Description *string
Args []*InputValue
Type TypeRef
IsDeprecated bool
DeprecationReason *string
}
type InputValue struct {
Name string
Description *string
Type TypeRef
DefaultValue *string
}
type TypeRef struct {
Kind TypeKind
Name *string
OfType *TypeRef
}
type Query struct {
Schema struct {
QueryType struct{ Name *string }
MutationType *struct{ Name *string }
SubscriptionType *struct{ Name *string }
Types FullTypes
Directives []*DirectiveType
} `graphql:"__schema"`
}
type DirectiveType struct {
Name string
Description *string
Locations []string
Args []*InputValue
}