-
Notifications
You must be signed in to change notification settings - Fork 0
/
models_gen.go
244 lines (204 loc) · 5.78 KB
/
models_gen.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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
package model
import (
"fmt"
"io"
"strconv"
)
type Entity interface {
IsEntity()
}
type AddNode struct {
Type string `json:"type"`
ID *string `json:"id"`
Properties map[string]interface{} `json:"properties"`
}
type Expression struct {
Key string `json:"key"`
Operator Operator `json:"operator"`
Value interface{} `json:"value"`
}
type Key struct {
Type string `json:"type"`
ID string `json:"id"`
}
type Node struct {
ID string `json:"id"`
Type string `json:"type"`
Properties map[string]interface{} `json:"properties"`
GetProperty interface{} `json:"getProperty"`
SetProperties bool `json:"setProperties"`
DelProperty bool `json:"delProperty"`
GetRelation *Relation `json:"getRelation"`
AddRelation *Relation `json:"addRelation"`
DelRelation bool `json:"delRelation"`
Relations *Relations `json:"relations"`
AddIncomingNode *Node `json:"addIncomingNode"`
AddOutboundNode *Node `json:"addOutboundNode"`
}
func (Node) IsEntity() {}
type NodeWhere struct {
Cursor *string `json:"cursor"`
Type string `json:"type"`
Expressions []*Expression `json:"expressions"`
PageSize *int `json:"page_size"`
OrderBy *OrderBy `json:"order_by"`
}
type Nodes struct {
Cursor string `json:"cursor"`
Values []*Node `json:"values"`
Agg float64 `json:"agg"`
}
type OrderBy struct {
Field string `json:"field"`
Reverse *bool `json:"reverse"`
}
type Relation struct {
ID string `json:"id"`
Type string `json:"type"`
Properties map[string]interface{} `json:"properties"`
GetProperty interface{} `json:"getProperty"`
SetProperties bool `json:"setProperties"`
DelProperty bool `json:"delProperty"`
Source *Node `json:"source"`
Target *Node `json:"target"`
}
func (Relation) IsEntity() {}
type RelationWhere struct {
Cursor *string `json:"cursor"`
Direction Direction `json:"direction"`
Relation string `json:"relation"`
TargetType string `json:"target_type"`
Expressions []*Expression `json:"expressions"`
PageSize *int `json:"page_size"`
OrderBy *OrderBy `json:"order_by"`
}
type Relations struct {
Cursor string `json:"cursor"`
Values []*Relation `json:"values"`
Agg float64 `json:"agg"`
}
type SetNode struct {
Type string `json:"type"`
ID string `json:"id"`
Properties map[string]interface{} `json:"properties"`
}
type AggregateFunction string
const (
AggregateFunctionSum AggregateFunction = "SUM"
AggregateFunctionCount AggregateFunction = "COUNT"
AggregateFunctionAvg AggregateFunction = "AVG"
AggregateFunctionMax AggregateFunction = "MAX"
AggregateFunctionMin AggregateFunction = "MIN"
)
var AllAggregateFunction = []AggregateFunction{
AggregateFunctionSum,
AggregateFunctionCount,
AggregateFunctionAvg,
AggregateFunctionMax,
AggregateFunctionMin,
}
func (e AggregateFunction) IsValid() bool {
switch e {
case AggregateFunctionSum, AggregateFunctionCount, AggregateFunctionAvg, AggregateFunctionMax, AggregateFunctionMin:
return true
}
return false
}
func (e AggregateFunction) String() string {
return string(e)
}
func (e *AggregateFunction) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = AggregateFunction(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid AggregateFunction", str)
}
return nil
}
func (e AggregateFunction) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
type Direction string
const (
DirectionOutgoing Direction = "OUTGOING"
DirectionIncoming Direction = "INCOMING"
)
var AllDirection = []Direction{
DirectionOutgoing,
DirectionIncoming,
}
func (e Direction) IsValid() bool {
switch e {
case DirectionOutgoing, DirectionIncoming:
return true
}
return false
}
func (e Direction) String() string {
return string(e)
}
func (e *Direction) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = Direction(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid Direction", str)
}
return nil
}
func (e Direction) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
type Operator string
const (
OperatorEq Operator = "EQ"
OperatorNeq Operator = "NEQ"
OperatorGt Operator = "GT"
OperatorLt Operator = "LT"
OperatorGte Operator = "GTE"
OperatorLte Operator = "LTE"
OperatorContains Operator = "CONTAINS"
OperatorHasPrefix Operator = "HAS_PREFIX"
OperatorHasSuffix Operator = "HAS_SUFFIX"
)
var AllOperator = []Operator{
OperatorEq,
OperatorNeq,
OperatorGt,
OperatorLt,
OperatorGte,
OperatorLte,
OperatorContains,
OperatorHasPrefix,
OperatorHasSuffix,
}
func (e Operator) IsValid() bool {
switch e {
case OperatorEq, OperatorNeq, OperatorGt, OperatorLt, OperatorGte, OperatorLte, OperatorContains, OperatorHasPrefix, OperatorHasSuffix:
return true
}
return false
}
func (e Operator) String() string {
return string(e)
}
func (e *Operator) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = Operator(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid Operator", str)
}
return nil
}
func (e Operator) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}