forked from wundergraph/graphql-go-tools
/
node_scalar.go
150 lines (117 loc) · 2.55 KB
/
node_scalar.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
package resolve
type Scalar struct {
Path []string
Nullable bool
Export *FieldExport `json:"export,omitempty"`
}
func (_ *Scalar) NodeKind() NodeKind {
return NodeKindScalar
}
func (s *Scalar) NodePath() []string {
return s.Path
}
func (s *Scalar) NodeNullable() bool {
return s.Nullable
}
type String struct {
Path []string
Nullable bool
Export *FieldExport `json:"export,omitempty"`
UnescapeResponseJson bool `json:"unescape_response_json,omitempty"`
IsTypeName bool `json:"is_type_name,omitempty"`
}
func (_ *String) NodeKind() NodeKind {
return NodeKindString
}
func (s *String) NodePath() []string {
return s.Path
}
func (s *String) NodeNullable() bool {
return s.Nullable
}
type StaticString struct {
Path []string
Value string
}
func (_ *StaticString) NodeKind() NodeKind {
return NodeKindStaticString
}
func (s *StaticString) NodePath() []string {
return s.Path
}
func (s *StaticString) NodeNullable() bool {
return false
}
type Boolean struct {
Path []string
Nullable bool
Export *FieldExport `json:"export,omitempty"`
}
func (_ *Boolean) NodeKind() NodeKind {
return NodeKindBoolean
}
func (b *Boolean) NodePath() []string {
return b.Path
}
func (b *Boolean) NodeNullable() bool {
return b.Nullable
}
type Float struct {
Path []string
Nullable bool
Export *FieldExport `json:"export,omitempty"`
}
func (_ *Float) NodeKind() NodeKind {
return NodeKindFloat
}
func (f *Float) NodePath() []string {
return f.Path
}
func (f *Float) NodeNullable() bool {
return f.Nullable
}
type Integer struct {
Path []string
Nullable bool
Export *FieldExport `json:"export,omitempty"`
}
func (_ *Integer) NodeKind() NodeKind {
return NodeKindInteger
}
func (i *Integer) NodePath() []string {
return i.Path
}
func (i *Integer) NodeNullable() bool {
return i.Nullable
}
type BigInt struct {
Path []string
Nullable bool
Export *FieldExport `json:"export,omitempty"`
}
func (_ *BigInt) NodeKind() NodeKind {
return NodeKindBigInt
}
func (b *BigInt) NodePath() []string {
return b.Path
}
func (b *BigInt) NodeNullable() bool {
return b.Nullable
}
type Null struct {
}
func (_ *Null) NodeKind() NodeKind {
return NodeKindNull
}
func (_ *Null) NodePath() []string {
return nil
}
func (_ *Null) NodeNullable() bool {
return true
}
// FieldExport takes the value of the field during evaluation (rendering of the field)
// and stores it in the variables using the Path as JSON pointer.
type FieldExport struct {
Path []string
AsString bool
}