-
Notifications
You must be signed in to change notification settings - Fork 0
/
models_gen.go
1124 lines (967 loc) · 32.8 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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
package model
import (
"fmt"
"io"
"strconv"
"time"
"github.com/fasibio/autogql/runtimehelper"
)
// AddCat result with filterable data and affected rows
type AddCatPayload struct {
Cat *CatQueryResult `json:"cat"`
Affected []*Cat `json:"affected"`
}
// AddCompany result with filterable data and affected rows
type AddCompanyPayload struct {
Company *CompanyQueryResult `json:"company"`
Affected []*Company `json:"affected"`
}
// AddSmartPhone result with filterable data and affected rows
type AddSmartPhonePayload struct {
SmartPhone *SmartPhoneQueryResult `json:"smartPhone"`
Affected []*SmartPhone `json:"affected"`
}
// AddTodo result with filterable data and affected rows
type AddTodoPayload struct {
Todo *TodoQueryResult `json:"todo"`
Affected []*Todo `json:"affected"`
}
// AddUser result with filterable data and affected rows
type AddUserPayload struct {
User *UserQueryResult `json:"user"`
Affected []*User `json:"affected"`
}
// Boolean Filter simple datatypes
type BooleanFilterInput struct {
And []*bool `json:"and,omitempty"`
Or []*bool `json:"or,omitempty"`
Not *BooleanFilterInput `json:"not,omitempty"`
Is *bool `json:"is,omitempty"`
Null *bool `json:"null,omitempty"`
NotNull *bool `json:"notNull,omitempty"`
}
type Cat struct {
ID int `json:"id" gorm:"primaryKey;autoIncrement;"`
Name string `json:"name"`
BirthDay time.Time `json:"birthDay"`
Age *int `json:"age,omitempty" gorm:"-;"`
UserID int `json:"userID"`
Alive *bool `json:"alive,omitempty" gorm:"default:true;"`
}
// Filter input selection for Cat
// Can be used f.e.: by queryCat
type CatFiltersInput struct {
ID *IDFilterInput `json:"id,omitempty"`
Name *StringFilterInput `json:"name,omitempty"`
BirthDay *TimeFilterInput `json:"birthDay,omitempty"`
UserID *IntFilterInput `json:"userID,omitempty"`
Alive *BooleanFilterInput `json:"alive,omitempty"`
And []*CatFiltersInput `json:"and,omitempty"`
Or []*CatFiltersInput `json:"or,omitempty"`
Not *CatFiltersInput `json:"not,omitempty"`
}
// Cat Input value to add new Cat
type CatInput struct {
Name string `json:"name"`
BirthDay time.Time `json:"birthDay"`
UserID int `json:"userID"`
Alive *bool `json:"alive,omitempty"`
}
// Order Cat by asc or desc
type CatOrder struct {
Asc *CatOrderable `json:"asc,omitempty"`
Desc *CatOrderable `json:"desc,omitempty"`
}
// Cat Patch value all values are optional to update Cat entities
type CatPatch struct {
Name *string `json:"name,omitempty"`
BirthDay *time.Time `json:"birthDay,omitempty"`
UserID *int `json:"userID,omitempty"`
Alive *bool `json:"alive,omitempty"`
}
// Cat result
type CatQueryResult struct {
Data []*Cat `json:"data"`
Count int `json:"count"`
TotalCount int `json:"totalCount"`
}
type Company struct {
ID int `json:"id" gorm:"primaryKey;autoIncrement;"`
Name string `json:"name"`
Description *string `json:"description,omitempty"`
MotherCompanyID *int `json:"motherCompanyID,omitempty"`
MotherCompany *Company `json:"motherCompany,omitempty"`
CreatedAt *time.Time `json:"createdAt,omitempty"`
}
// Filter input selection for Company
// Can be used f.e.: by queryCompany
type CompanyFiltersInput struct {
ID *IDFilterInput `json:"id,omitempty"`
Name *StringFilterInput `json:"name,omitempty"`
Description *StringFilterInput `json:"description,omitempty"`
MotherCompanyID *IntFilterInput `json:"motherCompanyID,omitempty"`
MotherCompany *CompanyFiltersInput `json:"motherCompany,omitempty"`
CreatedAt *TimeFilterInput `json:"createdAt,omitempty"`
And []*CompanyFiltersInput `json:"and,omitempty"`
Or []*CompanyFiltersInput `json:"or,omitempty"`
Not *CompanyFiltersInput `json:"not,omitempty"`
}
// Company Input value to add new Company
type CompanyInput struct {
Name string `json:"name"`
Description *string `json:"description,omitempty"`
MotherCompanyID *int `json:"motherCompanyID,omitempty"`
MotherCompany *CompanyInput `json:"motherCompany,omitempty"`
}
// Order Company by asc or desc
type CompanyOrder struct {
Asc *CompanyOrderable `json:"asc,omitempty"`
Desc *CompanyOrderable `json:"desc,omitempty"`
}
// Company Patch value all values are optional to update Company entities
type CompanyPatch struct {
Name *string `json:"name,omitempty"`
Description *string `json:"description,omitempty"`
MotherCompanyID *int `json:"motherCompanyID,omitempty"`
MotherCompany *CompanyPatch `json:"motherCompany,omitempty"`
}
// Company result
type CompanyQueryResult struct {
Data []*Company `json:"data"`
Count int `json:"count"`
TotalCount int `json:"totalCount"`
}
// DeleteCat result with filterable data and count of affected entries
type DeleteCatPayload struct {
Cat *CatQueryResult `json:"cat"`
// Count of deleted Cat entities
Count int `json:"count"`
Msg *string `json:"msg,omitempty"`
}
// DeleteCompany result with filterable data and count of affected entries
type DeleteCompanyPayload struct {
Company *CompanyQueryResult `json:"company"`
// Count of deleted Company entities
Count int `json:"count"`
Msg *string `json:"msg,omitempty"`
}
// DeleteSmartPhone result with filterable data and count of affected entries
type DeleteSmartPhonePayload struct {
SmartPhone *SmartPhoneQueryResult `json:"smartPhone"`
// Count of deleted SmartPhone entities
Count int `json:"count"`
Msg *string `json:"msg,omitempty"`
}
// DeleteTodo result with filterable data and count of affected entries
type DeleteTodoPayload struct {
Todo *TodoQueryResult `json:"todo"`
// Count of deleted Todo entities
Count int `json:"count"`
Msg *string `json:"msg,omitempty"`
}
// DeleteUser result with filterable data and count of affected entries
type DeleteUserPayload struct {
User *UserQueryResult `json:"user"`
// Count of deleted User entities
Count int `json:"count"`
Msg *string `json:"msg,omitempty"`
}
// Filter between start and end (start > value < end)
type FloatFilterBetween struct {
Start float64 `json:"start"`
End float64 `json:"end"`
}
// Float Filter simple datatypes
type FloatFilterInput struct {
And []*float64 `json:"and,omitempty"`
Or []*float64 `json:"or,omitempty"`
Not *FloatFilterInput `json:"not,omitempty"`
Eq *float64 `json:"eq,omitempty"`
Ne *float64 `json:"ne,omitempty"`
Gt *float64 `json:"gt,omitempty"`
Gte *float64 `json:"gte,omitempty"`
Lt *float64 `json:"lt,omitempty"`
Lte *float64 `json:"lte,omitempty"`
Null *bool `json:"null,omitempty"`
NotNull *bool `json:"notNull,omitempty"`
In []*float64 `json:"in,omitempty"`
NotIn []*float64 `json:"notIn,omitempty"`
Between *FloatFilterBetween `json:"between,omitempty"`
}
// ID Filter simple datatypes
type IDFilterInput struct {
And []*int `json:"and,omitempty"`
Or []*int `json:"or,omitempty"`
Not *IDFilterInput `json:"not,omitempty"`
Eq *int `json:"eq,omitempty"`
Ne *int `json:"ne,omitempty"`
Null *bool `json:"null,omitempty"`
NotNull *bool `json:"notNull,omitempty"`
In []*int `json:"in,omitempty"`
Notin []*int `json:"notin,omitempty"`
}
// Filter between start and end (start > value < end)
type IntFilterBetween struct {
Start int `json:"start"`
End int `json:"end"`
}
// Int Filter simple datatypes
type IntFilterInput struct {
And []*int `json:"and,omitempty"`
Or []*int `json:"or,omitempty"`
Not *IntFilterInput `json:"not,omitempty"`
Eq *int `json:"eq,omitempty"`
Ne *int `json:"ne,omitempty"`
Gt *int `json:"gt,omitempty"`
Gte *int `json:"gte,omitempty"`
Lt *int `json:"lt,omitempty"`
Lte *int `json:"lte,omitempty"`
Null *bool `json:"null,omitempty"`
NotNull *bool `json:"notNull,omitempty"`
In []*int `json:"in,omitempty"`
NotIn []*int `json:"notIn,omitempty"`
Between *IntFilterBetween `json:"between,omitempty"`
}
type Mutation struct {
}
type NoSQLControl struct {
ID int `json:"id"`
A *string `json:"a,omitempty"`
B int `json:"b"`
}
type Query struct {
}
type SmartPhone struct {
ID int `json:"id" gorm:"primaryKey;autoIncrement;"`
Brand string `json:"brand"`
Phonenumber string `json:"phonenumber"`
UserID int `json:"userID"`
}
// Filter input selection for SmartPhone
// Can be used f.e.: by querySmartPhone
type SmartPhoneFiltersInput struct {
ID *IDFilterInput `json:"id,omitempty"`
Brand *StringFilterInput `json:"brand,omitempty"`
Phonenumber *StringFilterInput `json:"phonenumber,omitempty"`
UserID *IDFilterInput `json:"userID,omitempty"`
And []*SmartPhoneFiltersInput `json:"and,omitempty"`
Or []*SmartPhoneFiltersInput `json:"or,omitempty"`
Not *SmartPhoneFiltersInput `json:"not,omitempty"`
}
// SmartPhone Input value to add new SmartPhone
type SmartPhoneInput struct {
Brand string `json:"brand"`
Phonenumber string `json:"phonenumber"`
UserID int `json:"userID"`
}
// Order SmartPhone by asc or desc
type SmartPhoneOrder struct {
Asc *SmartPhoneOrderable `json:"asc,omitempty"`
Desc *SmartPhoneOrderable `json:"desc,omitempty"`
}
// SmartPhone Patch value all values are optional to update SmartPhone entities
type SmartPhonePatch struct {
Brand *string `json:"brand,omitempty"`
Phonenumber *string `json:"phonenumber,omitempty"`
UserID *int `json:"userID,omitempty"`
}
// SmartPhone result
type SmartPhoneQueryResult struct {
Data []*SmartPhone `json:"data"`
Count int `json:"count"`
TotalCount int `json:"totalCount"`
}
// SoftDelete Filter simple datatypes
type SoftDeleteFilterInput struct {
And []*time.Time `json:"and,omitempty"`
Or []*time.Time `json:"or,omitempty"`
Not *SoftDeleteFilterInput `json:"not,omitempty"`
Eq *time.Time `json:"eq,omitempty"`
Ne *time.Time `json:"ne,omitempty"`
Gt *time.Time `json:"gt,omitempty"`
Gte *time.Time `json:"gte,omitempty"`
Lt *time.Time `json:"lt,omitempty"`
Lte *time.Time `json:"lte,omitempty"`
Null *bool `json:"null,omitempty"`
NotNull *bool `json:"notNull,omitempty"`
In []*time.Time `json:"in,omitempty"`
NotIn []*time.Time `json:"notIn,omitempty"`
Between *TimeFilterBetween `json:"between,omitempty"`
}
type SQLCreateExtension struct {
Value bool `json:"value"`
DirectiveExt []string `json:"directiveExt,omitempty"`
}
type SQLMutationParams struct {
Add *SQLCreateExtension `json:"add,omitempty"`
Update *SQLCreateExtension `json:"update,omitempty"`
Delete *SQLCreateExtension `json:"delete,omitempty"`
DirectiveExt []string `json:"directiveExt,omitempty"`
}
type SQLQueryParams struct {
Get *SQLCreateExtension `json:"get,omitempty"`
Query *SQLCreateExtension `json:"query,omitempty"`
DirectiveExt []string `json:"directiveExt,omitempty"`
}
// String Filter simple datatypes
type StringFilterInput struct {
And []*string `json:"and,omitempty"`
Or []*string `json:"or,omitempty"`
Not *StringFilterInput `json:"not,omitempty"`
Eq *string `json:"eq,omitempty"`
Eqi *string `json:"eqi,omitempty"`
Ne *string `json:"ne,omitempty"`
StartsWith *string `json:"startsWith,omitempty"`
EndsWith *string `json:"endsWith,omitempty"`
Contains *string `json:"contains,omitempty"`
NotContains *string `json:"notContains,omitempty"`
Containsi *string `json:"containsi,omitempty"`
NotContainsi *string `json:"notContainsi,omitempty"`
Null *bool `json:"null,omitempty"`
NotNull *bool `json:"notNull,omitempty"`
In []*string `json:"in,omitempty"`
NotIn []*string `json:"notIn,omitempty"`
}
// Filter between start and end (start > value < end)
type TimeFilterBetween struct {
Start time.Time `json:"start"`
End time.Time `json:"end"`
}
// Time Filter simple datatypes
type TimeFilterInput struct {
And []*time.Time `json:"and,omitempty"`
Or []*time.Time `json:"or,omitempty"`
Not *TimeFilterInput `json:"not,omitempty"`
Eq *time.Time `json:"eq,omitempty"`
Ne *time.Time `json:"ne,omitempty"`
Gt *time.Time `json:"gt,omitempty"`
Gte *time.Time `json:"gte,omitempty"`
Lt *time.Time `json:"lt,omitempty"`
Lte *time.Time `json:"lte,omitempty"`
Null *bool `json:"null,omitempty"`
NotNull *bool `json:"notNull,omitempty"`
In []*time.Time `json:"in,omitempty"`
NotIn []*time.Time `json:"notIn,omitempty"`
Between *TimeFilterBetween `json:"between,omitempty"`
}
// Filter input selection for Todo
// Can be used f.e.: by queryTodo
type TodoFiltersInput struct {
ID *IDFilterInput `json:"id,omitempty"`
Name *StringFilterInput `json:"name,omitempty"`
Users *UserFiltersInput `json:"users,omitempty"`
Owner *UserFiltersInput `json:"owner,omitempty"`
OwnerID *IDFilterInput `json:"ownerID,omitempty"`
CreatedAt *TimeFilterInput `json:"createdAt,omitempty"`
UpdatedAt *TimeFilterInput `json:"updatedAt,omitempty"`
DeletedAt *TimeFilterInput `json:"deletedAt,omitempty"`
Etype1 *StringFilterInput `json:"etype1,omitempty"`
Etype5 *StringFilterInput `json:"etype5,omitempty"`
And []*TodoFiltersInput `json:"and,omitempty"`
Or []*TodoFiltersInput `json:"or,omitempty"`
Not *TodoFiltersInput `json:"not,omitempty"`
}
// Todo Input value to add new Todo
type TodoInput struct {
Name string `json:"name"`
Etype1 *TodoType `json:"etype1,omitempty"`
Etype5 TodoType `json:"etype5"`
Test123 *string `json:"test123,omitempty"`
}
// Order Todo by asc or desc
type TodoOrder struct {
Asc *TodoOrderable `json:"asc,omitempty"`
Desc *TodoOrderable `json:"desc,omitempty"`
}
// Todo Patch value all values are optional to update Todo entities
type TodoPatch struct {
Name *string `json:"name,omitempty"`
Etype1 *TodoType `json:"etype1,omitempty"`
Etype5 *TodoType `json:"etype5,omitempty"`
Test123 *string `json:"test123,omitempty"`
}
// Todo result
type TodoQueryResult struct {
Data []*Todo `json:"data"`
Count int `json:"count"`
TotalCount int `json:"totalCount"`
}
// Update rules for Cat multiupdates simple possible by global filtervalue
type UpdateCatInput struct {
Filter *CatFiltersInput `json:"filter"`
Set *CatPatch `json:"set"`
}
// UpdateCat result with filterable data and affected rows
type UpdateCatPayload struct {
Cat *CatQueryResult `json:"cat"`
// Count of affected updates
Count int `json:"count"`
Affected []*Cat `json:"affected"`
}
// Update rules for Company multiupdates simple possible by global filtervalue
type UpdateCompanyInput struct {
Filter *CompanyFiltersInput `json:"filter"`
Set *CompanyPatch `json:"set"`
}
// UpdateCompany result with filterable data and affected rows
type UpdateCompanyPayload struct {
Company *CompanyQueryResult `json:"company"`
// Count of affected updates
Count int `json:"count"`
Affected []*Company `json:"affected"`
}
// Update rules for SmartPhone multiupdates simple possible by global filtervalue
type UpdateSmartPhoneInput struct {
Filter *SmartPhoneFiltersInput `json:"filter"`
Set *SmartPhonePatch `json:"set"`
}
// UpdateSmartPhone result with filterable data and affected rows
type UpdateSmartPhonePayload struct {
SmartPhone *SmartPhoneQueryResult `json:"smartPhone"`
// Count of affected updates
Count int `json:"count"`
Affected []*SmartPhone `json:"affected"`
}
// Update rules for Todo multiupdates simple possible by global filtervalue
type UpdateTodoInput struct {
Filter *TodoFiltersInput `json:"filter"`
Set *TodoPatch `json:"set"`
}
// UpdateTodo result with filterable data and affected rows
type UpdateTodoPayload struct {
Todo *TodoQueryResult `json:"todo"`
// Count of affected updates
Count int `json:"count"`
Affected []*Todo `json:"affected"`
}
// Update rules for User multiupdates simple possible by global filtervalue
type UpdateUserInput struct {
Filter *UserFiltersInput `json:"filter"`
Set *UserPatch `json:"set"`
}
// UpdateUser result with filterable data and affected rows
type UpdateUserPayload struct {
User *UserQueryResult `json:"user"`
// Count of affected updates
Count int `json:"count"`
Affected []*User `json:"affected"`
}
type User struct {
ID int `json:"id" gorm:"primaryKey;autoIncrement;"`
Name string `json:"name"`
CreatedAt *time.Time `json:"createdAt,omitempty"`
UpdatedAt *time.Time `json:"updatedAt,omitempty"`
DeletedAt *runtimehelper.SoftDelete `json:"deletedAt,omitempty" gorm:"index;"`
Cat *Cat `json:"cat,omitempty" gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;;"`
CompanyID *int `json:"companyID,omitempty"`
Money *float64 `json:"money,omitempty"`
Company *Company `json:"company,omitempty"`
SmartPhones []*SmartPhone `json:"smartPhones,omitempty"`
FavoritColor *string `json:"favoritColor,omitempty"`
Email string `json:"email"`
OtherDate *time.Time `json:"otherDate,omitempty"`
}
// Filter input selection for User
// Can be used f.e.: by queryUser
type UserFiltersInput struct {
ID *IDFilterInput `json:"id,omitempty"`
Name *StringFilterInput `json:"name,omitempty"`
CreatedAt *TimeFilterInput `json:"createdAt,omitempty"`
UpdatedAt *TimeFilterInput `json:"updatedAt,omitempty"`
Cat *CatFiltersInput `json:"cat,omitempty"`
CompanyID *IntFilterInput `json:"companyID,omitempty"`
Money *FloatFilterInput `json:"money,omitempty"`
Company *CompanyFiltersInput `json:"company,omitempty"`
SmartPhones *SmartPhoneFiltersInput `json:"smartPhones,omitempty"`
FavoritColor *StringFilterInput `json:"favoritColor,omitempty"`
Email *StringFilterInput `json:"email,omitempty"`
OtherDate *TimeFilterInput `json:"otherDate,omitempty"`
And []*UserFiltersInput `json:"and,omitempty"`
Or []*UserFiltersInput `json:"or,omitempty"`
Not *UserFiltersInput `json:"not,omitempty"`
}
// User Input value to add new User
type UserInput struct {
Name string `json:"name"`
Cat *CatInput `json:"cat,omitempty"`
CompanyID *int `json:"companyID,omitempty"`
Money *float64 `json:"money,omitempty"`
Company *CompanyInput `json:"company,omitempty"`
SmartPhones []*SmartPhoneInput `json:"smartPhones,omitempty"`
FavoritColor *string `json:"favoritColor,omitempty" validate:"omitempty,hexcolor|rgb|rgba"`
Email string `json:"email" validate:"required,email"`
OtherDate *time.Time `json:"otherDate,omitempty"`
}
// Order User by asc or desc
type UserOrder struct {
Asc *UserOrderable `json:"asc,omitempty"`
Desc *UserOrderable `json:"desc,omitempty"`
}
// User Patch value all values are optional to update User entities
type UserPatch struct {
Name *string `json:"name,omitempty"`
Cat *CatPatch `json:"cat,omitempty"`
CompanyID *int `json:"companyID,omitempty"`
Money *float64 `json:"money,omitempty"`
Company *CompanyPatch `json:"company,omitempty"`
SmartPhones []*SmartPhonePatch `json:"smartPhones,omitempty"`
FavoritColor *string `json:"favoritColor,omitempty" validate:"omitempty,hexcolor|rgb|rgba"`
Email *string `json:"email,omitempty" validate:"required,email"`
OtherDate *time.Time `json:"otherDate,omitempty"`
}
// User result
type UserQueryResult struct {
Data []*User `json:"data"`
Count int `json:"count"`
TotalCount int `json:"totalCount"`
}
// Many 2 many input between Todo and User
// Filter to Select Todo and set to set list of User PrimaryKeys
type UserRef2TodosInput struct {
Filter *TodoFiltersInput `json:"filter"`
Set []int `json:"set"`
}
// Groupable data for Cat
// Can be used f.e.: by queryCat
type CatGroup string
const (
CatGroupID CatGroup = "id"
CatGroupName CatGroup = "name"
CatGroupBirthDay CatGroup = "birthDay"
CatGroupUserID CatGroup = "userID"
CatGroupAlive CatGroup = "alive"
)
var AllCatGroup = []CatGroup{
CatGroupID,
CatGroupName,
CatGroupBirthDay,
CatGroupUserID,
CatGroupAlive,
}
func (e CatGroup) IsValid() bool {
switch e {
case CatGroupID, CatGroupName, CatGroupBirthDay, CatGroupUserID, CatGroupAlive:
return true
}
return false
}
func (e CatGroup) String() string {
return string(e)
}
func (e *CatGroup) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = CatGroup(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid CatGroup", str)
}
return nil
}
func (e CatGroup) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
// for Cat a enum of all orderable entities
// can be used f.e.: queryCat
type CatOrderable string
const (
CatOrderableID CatOrderable = "id"
CatOrderableName CatOrderable = "name"
CatOrderableUserID CatOrderable = "userID"
CatOrderableAlive CatOrderable = "alive"
)
var AllCatOrderable = []CatOrderable{
CatOrderableID,
CatOrderableName,
CatOrderableUserID,
CatOrderableAlive,
}
func (e CatOrderable) IsValid() bool {
switch e {
case CatOrderableID, CatOrderableName, CatOrderableUserID, CatOrderableAlive:
return true
}
return false
}
func (e CatOrderable) String() string {
return string(e)
}
func (e *CatOrderable) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = CatOrderable(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid CatOrderable", str)
}
return nil
}
func (e CatOrderable) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
// Groupable data for Company
// Can be used f.e.: by queryCompany
type CompanyGroup string
const (
CompanyGroupID CompanyGroup = "id"
CompanyGroupName CompanyGroup = "name"
CompanyGroupDescription CompanyGroup = "description"
CompanyGroupMotherCompanyID CompanyGroup = "motherCompanyID"
CompanyGroupCreatedAt CompanyGroup = "createdAt"
)
var AllCompanyGroup = []CompanyGroup{
CompanyGroupID,
CompanyGroupName,
CompanyGroupDescription,
CompanyGroupMotherCompanyID,
CompanyGroupCreatedAt,
}
func (e CompanyGroup) IsValid() bool {
switch e {
case CompanyGroupID, CompanyGroupName, CompanyGroupDescription, CompanyGroupMotherCompanyID, CompanyGroupCreatedAt:
return true
}
return false
}
func (e CompanyGroup) String() string {
return string(e)
}
func (e *CompanyGroup) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = CompanyGroup(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid CompanyGroup", str)
}
return nil
}
func (e CompanyGroup) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
// for Company a enum of all orderable entities
// can be used f.e.: queryCompany
type CompanyOrderable string
const (
CompanyOrderableID CompanyOrderable = "id"
CompanyOrderableName CompanyOrderable = "name"
CompanyOrderableDescription CompanyOrderable = "description"
CompanyOrderableMotherCompanyID CompanyOrderable = "motherCompanyID"
)
var AllCompanyOrderable = []CompanyOrderable{
CompanyOrderableID,
CompanyOrderableName,
CompanyOrderableDescription,
CompanyOrderableMotherCompanyID,
}
func (e CompanyOrderable) IsValid() bool {
switch e {
case CompanyOrderableID, CompanyOrderableName, CompanyOrderableDescription, CompanyOrderableMotherCompanyID:
return true
}
return false
}
func (e CompanyOrderable) String() string {
return string(e)
}
func (e *CompanyOrderable) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = CompanyOrderable(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid CompanyOrderable", str)
}
return nil
}
func (e CompanyOrderable) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
// Groupable data for SmartPhone
// Can be used f.e.: by querySmartPhone
type SmartPhoneGroup string
const (
SmartPhoneGroupID SmartPhoneGroup = "id"
SmartPhoneGroupBrand SmartPhoneGroup = "brand"
SmartPhoneGroupPhonenumber SmartPhoneGroup = "phonenumber"
SmartPhoneGroupUserID SmartPhoneGroup = "userID"
)
var AllSmartPhoneGroup = []SmartPhoneGroup{
SmartPhoneGroupID,
SmartPhoneGroupBrand,
SmartPhoneGroupPhonenumber,
SmartPhoneGroupUserID,
}
func (e SmartPhoneGroup) IsValid() bool {
switch e {
case SmartPhoneGroupID, SmartPhoneGroupBrand, SmartPhoneGroupPhonenumber, SmartPhoneGroupUserID:
return true
}
return false
}
func (e SmartPhoneGroup) String() string {
return string(e)
}
func (e *SmartPhoneGroup) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = SmartPhoneGroup(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid SmartPhoneGroup", str)
}
return nil
}
func (e SmartPhoneGroup) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
// for SmartPhone a enum of all orderable entities
// can be used f.e.: querySmartPhone
type SmartPhoneOrderable string
const (
SmartPhoneOrderableID SmartPhoneOrderable = "id"
SmartPhoneOrderableBrand SmartPhoneOrderable = "brand"
SmartPhoneOrderablePhonenumber SmartPhoneOrderable = "phonenumber"
SmartPhoneOrderableUserID SmartPhoneOrderable = "userID"
)
var AllSmartPhoneOrderable = []SmartPhoneOrderable{
SmartPhoneOrderableID,
SmartPhoneOrderableBrand,
SmartPhoneOrderablePhonenumber,
SmartPhoneOrderableUserID,
}
func (e SmartPhoneOrderable) IsValid() bool {
switch e {
case SmartPhoneOrderableID, SmartPhoneOrderableBrand, SmartPhoneOrderablePhonenumber, SmartPhoneOrderableUserID:
return true
}
return false
}
func (e SmartPhoneOrderable) String() string {
return string(e)
}
func (e *SmartPhoneOrderable) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = SmartPhoneOrderable(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid SmartPhoneOrderable", str)
}
return nil
}
func (e SmartPhoneOrderable) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
// Groupable data for Todo
// Can be used f.e.: by queryTodo
type TodoGroup string
const (
TodoGroupID TodoGroup = "id"
TodoGroupName TodoGroup = "name"
TodoGroupOwnerID TodoGroup = "ownerID"
TodoGroupCreatedAt TodoGroup = "createdAt"
TodoGroupUpdatedAt TodoGroup = "updatedAt"
TodoGroupDeletedAt TodoGroup = "deletedAt"
)
var AllTodoGroup = []TodoGroup{
TodoGroupID,
TodoGroupName,
TodoGroupOwnerID,
TodoGroupCreatedAt,
TodoGroupUpdatedAt,
TodoGroupDeletedAt,
}
func (e TodoGroup) IsValid() bool {
switch e {
case TodoGroupID, TodoGroupName, TodoGroupOwnerID, TodoGroupCreatedAt, TodoGroupUpdatedAt, TodoGroupDeletedAt:
return true
}
return false
}
func (e TodoGroup) String() string {
return string(e)
}
func (e *TodoGroup) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = TodoGroup(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid TodoGroup", str)
}
return nil
}
func (e TodoGroup) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
// for Todo a enum of all orderable entities
// can be used f.e.: queryTodo
type TodoOrderable string
const (
TodoOrderableID TodoOrderable = "id"
TodoOrderableName TodoOrderable = "name"
TodoOrderableOwnerID TodoOrderable = "ownerID"
)
var AllTodoOrderable = []TodoOrderable{
TodoOrderableID,
TodoOrderableName,
TodoOrderableOwnerID,
}
func (e TodoOrderable) IsValid() bool {
switch e {
case TodoOrderableID, TodoOrderableName, TodoOrderableOwnerID:
return true
}
return false
}
func (e TodoOrderable) String() string {
return string(e)
}
func (e *TodoOrderable) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = TodoOrderable(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid TodoOrderable", str)
}
return nil
}
func (e TodoOrderable) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
type TodoType string
const (
TodoTypeBug TodoType = "Bug"
TodoTypeFeature TodoType = "Feature"
)
var AllTodoType = []TodoType{
TodoTypeBug,
TodoTypeFeature,
}
func (e TodoType) IsValid() bool {
switch e {
case TodoTypeBug, TodoTypeFeature:
return true
}
return false
}
func (e TodoType) String() string {
return string(e)
}