-
Notifications
You must be signed in to change notification settings - Fork 8
/
gen_models.go
266 lines (226 loc) · 7.47 KB
/
gen_models.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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
package testclient
import (
"fmt"
"io"
"strconv"
"time"
"go.infratographer.com/x/gidx"
)
type MetadataNode interface {
IsMetadataNode()
GetID() gidx.PrefixedID
}
// An object with an ID.
// Follows the [Relay Global Object Identification Specification](https://relay.dev/graphql/objectidentification.htm)
type Node interface {
IsNode()
// The id of the object.
GetID() gidx.PrefixedID
}
type ResourceOwner interface {
IsResourceOwner()
GetID() gidx.PrefixedID
}
type Entity interface {
IsEntity()
}
// Input information to create a tenant.
type CreateTenantInput struct {
// The name of a tenant.
Name string `json:"name"`
// An optional description of the tenant.
Description *string `json:"description,omitempty"`
ParentID *gidx.PrefixedID `json:"parentID,omitempty"`
}
// Information about pagination in a connection.
// https://relay.dev/graphql/connections.htm#sec-undefined.PageInfo
type PageInfo struct {
// When paginating forwards, are there more items?
HasNextPage bool `json:"hasNextPage"`
// When paginating backwards, are there more items?
HasPreviousPage bool `json:"hasPreviousPage"`
// When paginating backwards, the cursor to continue.
StartCursor *string `json:"startCursor,omitempty"`
// When paginating forwards, the cursor to continue.
EndCursor *string `json:"endCursor,omitempty"`
}
type Tenant struct {
// ID for the tenant.
ID gidx.PrefixedID `json:"id"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
// The name of a tenant.
Name string `json:"name"`
// An optional description of the tenant.
Description *string `json:"description,omitempty"`
Parent *Tenant `json:"parent,omitempty"`
Children TenantConnection `json:"children"`
}
func (Tenant) IsMetadataNode() {}
func (this Tenant) GetID() gidx.PrefixedID { return this.ID }
func (Tenant) IsNode() {}
// The id of the object.
func (Tenant) IsResourceOwner() {}
func (Tenant) IsEntity() {}
// A connection to a list of items.
type TenantConnection struct {
// A list of edges.
Edges []*TenantEdge `json:"edges,omitempty"`
// Information to aid in pagination.
PageInfo PageInfo `json:"pageInfo"`
// Identifies the total count of items in the connection.
TotalCount int64 `json:"totalCount"`
}
// Return response from tenantCreate.
type TenantCreatePayload struct {
// The created tenant.
Tenant Tenant `json:"tenant"`
}
// Return response from tenantDelete.
type TenantDeletePayload struct {
// The ID of the deleted tenant.
DeletedID gidx.PrefixedID `json:"deletedID"`
}
// An edge in a connection.
type TenantEdge struct {
// The item at the end of the edge.
Node *Tenant `json:"node,omitempty"`
// A cursor for use in pagination.
Cursor string `json:"cursor"`
}
// Ordering options for Tenant connections
type TenantOrder struct {
// The ordering direction.
Direction OrderDirection `json:"direction"`
// The field by which to order Tenants.
Field TenantOrderField `json:"field"`
}
// Return response from tenantUpdate.
type TenantUpdatePayload struct {
// The updated tenant.
Tenant Tenant `json:"tenant"`
}
// TenantWhereInput is used for filtering Tenant objects.
// Input was generated by ent.
type TenantWhereInput struct {
Not *TenantWhereInput `json:"not,omitempty"`
And []*TenantWhereInput `json:"and,omitempty"`
Or []*TenantWhereInput `json:"or,omitempty"`
// id field predicates
ID *gidx.PrefixedID `json:"id,omitempty"`
IDNeq *gidx.PrefixedID `json:"idNEQ,omitempty"`
IDIn []gidx.PrefixedID `json:"idIn,omitempty"`
IDNotIn []gidx.PrefixedID `json:"idNotIn,omitempty"`
IDGt *gidx.PrefixedID `json:"idGT,omitempty"`
IDGte *gidx.PrefixedID `json:"idGTE,omitempty"`
IDLt *gidx.PrefixedID `json:"idLT,omitempty"`
IDLte *gidx.PrefixedID `json:"idLTE,omitempty"`
// created_at field predicates
CreatedAt *time.Time `json:"createdAt,omitempty"`
CreatedAtNeq *time.Time `json:"createdAtNEQ,omitempty"`
CreatedAtIn []*time.Time `json:"createdAtIn,omitempty"`
CreatedAtNotIn []*time.Time `json:"createdAtNotIn,omitempty"`
CreatedAtGt *time.Time `json:"createdAtGT,omitempty"`
CreatedAtGte *time.Time `json:"createdAtGTE,omitempty"`
CreatedAtLt *time.Time `json:"createdAtLT,omitempty"`
CreatedAtLte *time.Time `json:"createdAtLTE,omitempty"`
// updated_at field predicates
UpdatedAt *time.Time `json:"updatedAt,omitempty"`
UpdatedAtNeq *time.Time `json:"updatedAtNEQ,omitempty"`
UpdatedAtIn []*time.Time `json:"updatedAtIn,omitempty"`
UpdatedAtNotIn []*time.Time `json:"updatedAtNotIn,omitempty"`
UpdatedAtGt *time.Time `json:"updatedAtGT,omitempty"`
UpdatedAtGte *time.Time `json:"updatedAtGTE,omitempty"`
UpdatedAtLt *time.Time `json:"updatedAtLT,omitempty"`
UpdatedAtLte *time.Time `json:"updatedAtLTE,omitempty"`
// parent edge predicates
HasParent *bool `json:"hasParent,omitempty"`
HasParentWith []*TenantWhereInput `json:"hasParentWith,omitempty"`
// children edge predicates
HasChildren *bool `json:"hasChildren,omitempty"`
HasChildrenWith []*TenantWhereInput `json:"hasChildrenWith,omitempty"`
}
// Input information to update a tenant.
type UpdateTenantInput struct {
// The name of a tenant.
Name *string `json:"name,omitempty"`
// An optional description of the tenant.
Description *string `json:"description,omitempty"`
ClearDescription *bool `json:"clearDescription,omitempty"`
}
type Service struct {
Sdl *string `json:"sdl,omitempty"`
}
// Possible directions in which to order a list of items when provided an `orderBy` argument.
type OrderDirection string
const (
// Specifies an ascending order for a given `orderBy` argument.
OrderDirectionAsc OrderDirection = "ASC"
// Specifies a descending order for a given `orderBy` argument.
OrderDirectionDesc OrderDirection = "DESC"
)
var AllOrderDirection = []OrderDirection{
OrderDirectionAsc,
OrderDirectionDesc,
}
func (e OrderDirection) IsValid() bool {
switch e {
case OrderDirectionAsc, OrderDirectionDesc:
return true
}
return false
}
func (e OrderDirection) String() string {
return string(e)
}
func (e *OrderDirection) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = OrderDirection(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid OrderDirection", str)
}
return nil
}
func (e OrderDirection) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
// Properties by which Tenant connections can be ordered.
type TenantOrderField string
const (
TenantOrderFieldCreatedAt TenantOrderField = "CREATED_AT"
TenantOrderFieldUpdatedAt TenantOrderField = "UPDATED_AT"
TenantOrderFieldName TenantOrderField = "NAME"
)
var AllTenantOrderField = []TenantOrderField{
TenantOrderFieldCreatedAt,
TenantOrderFieldUpdatedAt,
TenantOrderFieldName,
}
func (e TenantOrderField) IsValid() bool {
switch e {
case TenantOrderFieldCreatedAt, TenantOrderFieldUpdatedAt, TenantOrderFieldName:
return true
}
return false
}
func (e TenantOrderField) String() string {
return string(e)
}
func (e *TenantOrderField) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = TenantOrderField(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid TenantOrderField", str)
}
return nil
}
func (e TenantOrderField) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}