-
Notifications
You must be signed in to change notification settings - Fork 0
/
gong.go
2019 lines (1782 loc) · 58.8 KB
/
gong.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
// generated code - do not edit
package models
import (
"cmp"
"errors"
"fmt"
"math"
"slices"
"time"
"golang.org/x/exp/maps"
)
func __Gong__Abs(x int) int {
if x < 0 {
return -x
}
return x
}
// errUnkownEnum is returns when a value cannot match enum values
var errUnkownEnum = errors.New("unkown enum")
// needed to avoid when fmt package is not needed by generated code
var __dummy__fmt_variable fmt.Scanner
// idem for math package when not need by generated code
var __dummy_math_variable = math.E
// swagger:ignore
type __void any
// needed for creating set of instances in the stage
var __member __void
// GongStructInterface is the interface met by GongStructs
// It allows runtime reflexion of instances (without the hassle of the "reflect" package)
type GongStructInterface interface {
GetName() (res string)
// GetID() (res int)
// GetFields() (res []string)
// GetFieldStringValue(fieldName string) (res string)
}
// StageStruct enables storage of staged instances
// swagger:ignore
type StageStruct struct {
path string
// insertion point for definition of arrays registering instances
Circles map[*Circle]any
Circles_mapString map[string]*Circle
// insertion point for slice of pointers maps
OnAfterCircleCreateCallback OnAfterCreateInterface[Circle]
OnAfterCircleUpdateCallback OnAfterUpdateInterface[Circle]
OnAfterCircleDeleteCallback OnAfterDeleteInterface[Circle]
OnAfterCircleReadCallback OnAfterReadInterface[Circle]
DivIcons map[*DivIcon]any
DivIcons_mapString map[string]*DivIcon
// insertion point for slice of pointers maps
OnAfterDivIconCreateCallback OnAfterCreateInterface[DivIcon]
OnAfterDivIconUpdateCallback OnAfterUpdateInterface[DivIcon]
OnAfterDivIconDeleteCallback OnAfterDeleteInterface[DivIcon]
OnAfterDivIconReadCallback OnAfterReadInterface[DivIcon]
LayerGroups map[*LayerGroup]any
LayerGroups_mapString map[string]*LayerGroup
// insertion point for slice of pointers maps
OnAfterLayerGroupCreateCallback OnAfterCreateInterface[LayerGroup]
OnAfterLayerGroupUpdateCallback OnAfterUpdateInterface[LayerGroup]
OnAfterLayerGroupDeleteCallback OnAfterDeleteInterface[LayerGroup]
OnAfterLayerGroupReadCallback OnAfterReadInterface[LayerGroup]
LayerGroupUses map[*LayerGroupUse]any
LayerGroupUses_mapString map[string]*LayerGroupUse
// insertion point for slice of pointers maps
OnAfterLayerGroupUseCreateCallback OnAfterCreateInterface[LayerGroupUse]
OnAfterLayerGroupUseUpdateCallback OnAfterUpdateInterface[LayerGroupUse]
OnAfterLayerGroupUseDeleteCallback OnAfterDeleteInterface[LayerGroupUse]
OnAfterLayerGroupUseReadCallback OnAfterReadInterface[LayerGroupUse]
MapOptionss map[*MapOptions]any
MapOptionss_mapString map[string]*MapOptions
// insertion point for slice of pointers maps
MapOptions_LayerGroupUses_reverseMap map[*LayerGroupUse]*MapOptions
OnAfterMapOptionsCreateCallback OnAfterCreateInterface[MapOptions]
OnAfterMapOptionsUpdateCallback OnAfterUpdateInterface[MapOptions]
OnAfterMapOptionsDeleteCallback OnAfterDeleteInterface[MapOptions]
OnAfterMapOptionsReadCallback OnAfterReadInterface[MapOptions]
Markers map[*Marker]any
Markers_mapString map[string]*Marker
// insertion point for slice of pointers maps
OnAfterMarkerCreateCallback OnAfterCreateInterface[Marker]
OnAfterMarkerUpdateCallback OnAfterUpdateInterface[Marker]
OnAfterMarkerDeleteCallback OnAfterDeleteInterface[Marker]
OnAfterMarkerReadCallback OnAfterReadInterface[Marker]
UserClicks map[*UserClick]any
UserClicks_mapString map[string]*UserClick
// insertion point for slice of pointers maps
OnAfterUserClickCreateCallback OnAfterCreateInterface[UserClick]
OnAfterUserClickUpdateCallback OnAfterUpdateInterface[UserClick]
OnAfterUserClickDeleteCallback OnAfterDeleteInterface[UserClick]
OnAfterUserClickReadCallback OnAfterReadInterface[UserClick]
VLines map[*VLine]any
VLines_mapString map[string]*VLine
// insertion point for slice of pointers maps
OnAfterVLineCreateCallback OnAfterCreateInterface[VLine]
OnAfterVLineUpdateCallback OnAfterUpdateInterface[VLine]
OnAfterVLineDeleteCallback OnAfterDeleteInterface[VLine]
OnAfterVLineReadCallback OnAfterReadInterface[VLine]
VisualTracks map[*VisualTrack]any
VisualTracks_mapString map[string]*VisualTrack
// insertion point for slice of pointers maps
OnAfterVisualTrackCreateCallback OnAfterCreateInterface[VisualTrack]
OnAfterVisualTrackUpdateCallback OnAfterUpdateInterface[VisualTrack]
OnAfterVisualTrackDeleteCallback OnAfterDeleteInterface[VisualTrack]
OnAfterVisualTrackReadCallback OnAfterReadInterface[VisualTrack]
AllModelsStructCreateCallback AllModelsStructCreateInterface
AllModelsStructDeleteCallback AllModelsStructDeleteInterface
BackRepo BackRepoInterface
// if set will be called before each commit to the back repo
OnInitCommitCallback OnInitCommitInterface
OnInitCommitFromFrontCallback OnInitCommitInterface
OnInitCommitFromBackCallback OnInitCommitInterface
// store the number of instance per gongstruct
Map_GongStructName_InstancesNb map[string]int
// store meta package import
MetaPackageImportPath string
MetaPackageImportAlias string
// to be removed after fix of [issue](https://github.com/golang/go/issues/57559)
// map to enable docLink renaming when an identifier is renamed
Map_DocLink_Renaming map[string]GONG__Identifier
// the to be removed stops here
}
func (stage *StageStruct) GetType() string {
return "github.com/fullstack-lang/gongleaflet/go/models"
}
type GONG__Identifier struct {
Ident string
Type GONG__ExpressionType
}
type OnInitCommitInterface interface {
BeforeCommit(stage *StageStruct)
}
// OnAfterCreateInterface callback when an instance is updated from the front
type OnAfterCreateInterface[Type Gongstruct] interface {
OnAfterCreate(stage *StageStruct,
instance *Type)
}
// OnAfterReadInterface callback when an instance is updated from the front
type OnAfterReadInterface[Type Gongstruct] interface {
OnAfterRead(stage *StageStruct,
instance *Type)
}
// OnAfterUpdateInterface callback when an instance is updated from the front
type OnAfterUpdateInterface[Type Gongstruct] interface {
OnAfterUpdate(stage *StageStruct, old, new *Type)
}
// OnAfterDeleteInterface callback when an instance is updated from the front
type OnAfterDeleteInterface[Type Gongstruct] interface {
OnAfterDelete(stage *StageStruct,
staged, front *Type)
}
type BackRepoInterface interface {
Commit(stage *StageStruct)
Checkout(stage *StageStruct)
Backup(stage *StageStruct, dirPath string)
Restore(stage *StageStruct, dirPath string)
BackupXL(stage *StageStruct, dirPath string)
RestoreXL(stage *StageStruct, dirPath string)
// insertion point for Commit and Checkout signatures
CommitCircle(circle *Circle)
CheckoutCircle(circle *Circle)
CommitDivIcon(divicon *DivIcon)
CheckoutDivIcon(divicon *DivIcon)
CommitLayerGroup(layergroup *LayerGroup)
CheckoutLayerGroup(layergroup *LayerGroup)
CommitLayerGroupUse(layergroupuse *LayerGroupUse)
CheckoutLayerGroupUse(layergroupuse *LayerGroupUse)
CommitMapOptions(mapoptions *MapOptions)
CheckoutMapOptions(mapoptions *MapOptions)
CommitMarker(marker *Marker)
CheckoutMarker(marker *Marker)
CommitUserClick(userclick *UserClick)
CheckoutUserClick(userclick *UserClick)
CommitVLine(vline *VLine)
CheckoutVLine(vline *VLine)
CommitVisualTrack(visualtrack *VisualTrack)
CheckoutVisualTrack(visualtrack *VisualTrack)
GetLastCommitFromBackNb() uint
GetLastPushFromFrontNb() uint
}
func NewStage(path string) (stage *StageStruct) {
stage = &StageStruct{ // insertion point for array initiatialisation
Circles: make(map[*Circle]any),
Circles_mapString: make(map[string]*Circle),
DivIcons: make(map[*DivIcon]any),
DivIcons_mapString: make(map[string]*DivIcon),
LayerGroups: make(map[*LayerGroup]any),
LayerGroups_mapString: make(map[string]*LayerGroup),
LayerGroupUses: make(map[*LayerGroupUse]any),
LayerGroupUses_mapString: make(map[string]*LayerGroupUse),
MapOptionss: make(map[*MapOptions]any),
MapOptionss_mapString: make(map[string]*MapOptions),
Markers: make(map[*Marker]any),
Markers_mapString: make(map[string]*Marker),
UserClicks: make(map[*UserClick]any),
UserClicks_mapString: make(map[string]*UserClick),
VLines: make(map[*VLine]any),
VLines_mapString: make(map[string]*VLine),
VisualTracks: make(map[*VisualTrack]any),
VisualTracks_mapString: make(map[string]*VisualTrack),
// end of insertion point
Map_GongStructName_InstancesNb: make(map[string]int),
path: path,
// to be removed after fix of [issue](https://github.com/golang/go/issues/57559)
Map_DocLink_Renaming: make(map[string]GONG__Identifier),
// the to be removed stops here
}
return
}
func (stage *StageStruct) GetPath() string {
return stage.path
}
func (stage *StageStruct) CommitWithSuspendedCallbacks() {
tmp := stage.OnInitCommitFromBackCallback
stage.OnInitCommitFromBackCallback = nil
stage.Commit()
stage.OnInitCommitFromBackCallback = tmp
}
func (stage *StageStruct) Commit() {
stage.ComputeReverseMaps()
if stage.BackRepo != nil {
stage.BackRepo.Commit(stage)
}
// insertion point for computing the map of number of instances per gongstruct
stage.Map_GongStructName_InstancesNb["Circle"] = len(stage.Circles)
stage.Map_GongStructName_InstancesNb["DivIcon"] = len(stage.DivIcons)
stage.Map_GongStructName_InstancesNb["LayerGroup"] = len(stage.LayerGroups)
stage.Map_GongStructName_InstancesNb["LayerGroupUse"] = len(stage.LayerGroupUses)
stage.Map_GongStructName_InstancesNb["MapOptions"] = len(stage.MapOptionss)
stage.Map_GongStructName_InstancesNb["Marker"] = len(stage.Markers)
stage.Map_GongStructName_InstancesNb["UserClick"] = len(stage.UserClicks)
stage.Map_GongStructName_InstancesNb["VLine"] = len(stage.VLines)
stage.Map_GongStructName_InstancesNb["VisualTrack"] = len(stage.VisualTracks)
}
func (stage *StageStruct) Checkout() {
if stage.BackRepo != nil {
stage.BackRepo.Checkout(stage)
}
stage.ComputeReverseMaps()
// insertion point for computing the map of number of instances per gongstruct
stage.Map_GongStructName_InstancesNb["Circle"] = len(stage.Circles)
stage.Map_GongStructName_InstancesNb["DivIcon"] = len(stage.DivIcons)
stage.Map_GongStructName_InstancesNb["LayerGroup"] = len(stage.LayerGroups)
stage.Map_GongStructName_InstancesNb["LayerGroupUse"] = len(stage.LayerGroupUses)
stage.Map_GongStructName_InstancesNb["MapOptions"] = len(stage.MapOptionss)
stage.Map_GongStructName_InstancesNb["Marker"] = len(stage.Markers)
stage.Map_GongStructName_InstancesNb["UserClick"] = len(stage.UserClicks)
stage.Map_GongStructName_InstancesNb["VLine"] = len(stage.VLines)
stage.Map_GongStructName_InstancesNb["VisualTrack"] = len(stage.VisualTracks)
}
// backup generates backup files in the dirPath
func (stage *StageStruct) Backup(dirPath string) {
if stage.BackRepo != nil {
stage.BackRepo.Backup(stage, dirPath)
}
}
// Restore resets Stage & BackRepo and restores their content from the restore files in dirPath
func (stage *StageStruct) Restore(dirPath string) {
if stage.BackRepo != nil {
stage.BackRepo.Restore(stage, dirPath)
}
}
// backup generates backup files in the dirPath
func (stage *StageStruct) BackupXL(dirPath string) {
if stage.BackRepo != nil {
stage.BackRepo.BackupXL(stage, dirPath)
}
}
// Restore resets Stage & BackRepo and restores their content from the restore files in dirPath
func (stage *StageStruct) RestoreXL(dirPath string) {
if stage.BackRepo != nil {
stage.BackRepo.RestoreXL(stage, dirPath)
}
}
// insertion point for cumulative sub template with model space calls
// Stage puts circle to the model stage
func (circle *Circle) Stage(stage *StageStruct) *Circle {
stage.Circles[circle] = __member
stage.Circles_mapString[circle.Name] = circle
return circle
}
// Unstage removes circle off the model stage
func (circle *Circle) Unstage(stage *StageStruct) *Circle {
delete(stage.Circles, circle)
delete(stage.Circles_mapString, circle.Name)
return circle
}
// UnstageVoid removes circle off the model stage
func (circle *Circle) UnstageVoid(stage *StageStruct) {
delete(stage.Circles, circle)
delete(stage.Circles_mapString, circle.Name)
}
// commit circle to the back repo (if it is already staged)
func (circle *Circle) Commit(stage *StageStruct) *Circle {
if _, ok := stage.Circles[circle]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CommitCircle(circle)
}
}
return circle
}
func (circle *Circle) CommitVoid(stage *StageStruct) {
circle.Commit(stage)
}
// Checkout circle to the back repo (if it is already staged)
func (circle *Circle) Checkout(stage *StageStruct) *Circle {
if _, ok := stage.Circles[circle]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CheckoutCircle(circle)
}
}
return circle
}
// for satisfaction of GongStruct interface
func (circle *Circle) GetName() (res string) {
return circle.Name
}
// Stage puts divicon to the model stage
func (divicon *DivIcon) Stage(stage *StageStruct) *DivIcon {
stage.DivIcons[divicon] = __member
stage.DivIcons_mapString[divicon.Name] = divicon
return divicon
}
// Unstage removes divicon off the model stage
func (divicon *DivIcon) Unstage(stage *StageStruct) *DivIcon {
delete(stage.DivIcons, divicon)
delete(stage.DivIcons_mapString, divicon.Name)
return divicon
}
// UnstageVoid removes divicon off the model stage
func (divicon *DivIcon) UnstageVoid(stage *StageStruct) {
delete(stage.DivIcons, divicon)
delete(stage.DivIcons_mapString, divicon.Name)
}
// commit divicon to the back repo (if it is already staged)
func (divicon *DivIcon) Commit(stage *StageStruct) *DivIcon {
if _, ok := stage.DivIcons[divicon]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CommitDivIcon(divicon)
}
}
return divicon
}
func (divicon *DivIcon) CommitVoid(stage *StageStruct) {
divicon.Commit(stage)
}
// Checkout divicon to the back repo (if it is already staged)
func (divicon *DivIcon) Checkout(stage *StageStruct) *DivIcon {
if _, ok := stage.DivIcons[divicon]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CheckoutDivIcon(divicon)
}
}
return divicon
}
// for satisfaction of GongStruct interface
func (divicon *DivIcon) GetName() (res string) {
return divicon.Name
}
// Stage puts layergroup to the model stage
func (layergroup *LayerGroup) Stage(stage *StageStruct) *LayerGroup {
stage.LayerGroups[layergroup] = __member
stage.LayerGroups_mapString[layergroup.Name] = layergroup
return layergroup
}
// Unstage removes layergroup off the model stage
func (layergroup *LayerGroup) Unstage(stage *StageStruct) *LayerGroup {
delete(stage.LayerGroups, layergroup)
delete(stage.LayerGroups_mapString, layergroup.Name)
return layergroup
}
// UnstageVoid removes layergroup off the model stage
func (layergroup *LayerGroup) UnstageVoid(stage *StageStruct) {
delete(stage.LayerGroups, layergroup)
delete(stage.LayerGroups_mapString, layergroup.Name)
}
// commit layergroup to the back repo (if it is already staged)
func (layergroup *LayerGroup) Commit(stage *StageStruct) *LayerGroup {
if _, ok := stage.LayerGroups[layergroup]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CommitLayerGroup(layergroup)
}
}
return layergroup
}
func (layergroup *LayerGroup) CommitVoid(stage *StageStruct) {
layergroup.Commit(stage)
}
// Checkout layergroup to the back repo (if it is already staged)
func (layergroup *LayerGroup) Checkout(stage *StageStruct) *LayerGroup {
if _, ok := stage.LayerGroups[layergroup]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CheckoutLayerGroup(layergroup)
}
}
return layergroup
}
// for satisfaction of GongStruct interface
func (layergroup *LayerGroup) GetName() (res string) {
return layergroup.Name
}
// Stage puts layergroupuse to the model stage
func (layergroupuse *LayerGroupUse) Stage(stage *StageStruct) *LayerGroupUse {
stage.LayerGroupUses[layergroupuse] = __member
stage.LayerGroupUses_mapString[layergroupuse.Name] = layergroupuse
return layergroupuse
}
// Unstage removes layergroupuse off the model stage
func (layergroupuse *LayerGroupUse) Unstage(stage *StageStruct) *LayerGroupUse {
delete(stage.LayerGroupUses, layergroupuse)
delete(stage.LayerGroupUses_mapString, layergroupuse.Name)
return layergroupuse
}
// UnstageVoid removes layergroupuse off the model stage
func (layergroupuse *LayerGroupUse) UnstageVoid(stage *StageStruct) {
delete(stage.LayerGroupUses, layergroupuse)
delete(stage.LayerGroupUses_mapString, layergroupuse.Name)
}
// commit layergroupuse to the back repo (if it is already staged)
func (layergroupuse *LayerGroupUse) Commit(stage *StageStruct) *LayerGroupUse {
if _, ok := stage.LayerGroupUses[layergroupuse]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CommitLayerGroupUse(layergroupuse)
}
}
return layergroupuse
}
func (layergroupuse *LayerGroupUse) CommitVoid(stage *StageStruct) {
layergroupuse.Commit(stage)
}
// Checkout layergroupuse to the back repo (if it is already staged)
func (layergroupuse *LayerGroupUse) Checkout(stage *StageStruct) *LayerGroupUse {
if _, ok := stage.LayerGroupUses[layergroupuse]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CheckoutLayerGroupUse(layergroupuse)
}
}
return layergroupuse
}
// for satisfaction of GongStruct interface
func (layergroupuse *LayerGroupUse) GetName() (res string) {
return layergroupuse.Name
}
// Stage puts mapoptions to the model stage
func (mapoptions *MapOptions) Stage(stage *StageStruct) *MapOptions {
stage.MapOptionss[mapoptions] = __member
stage.MapOptionss_mapString[mapoptions.Name] = mapoptions
return mapoptions
}
// Unstage removes mapoptions off the model stage
func (mapoptions *MapOptions) Unstage(stage *StageStruct) *MapOptions {
delete(stage.MapOptionss, mapoptions)
delete(stage.MapOptionss_mapString, mapoptions.Name)
return mapoptions
}
// UnstageVoid removes mapoptions off the model stage
func (mapoptions *MapOptions) UnstageVoid(stage *StageStruct) {
delete(stage.MapOptionss, mapoptions)
delete(stage.MapOptionss_mapString, mapoptions.Name)
}
// commit mapoptions to the back repo (if it is already staged)
func (mapoptions *MapOptions) Commit(stage *StageStruct) *MapOptions {
if _, ok := stage.MapOptionss[mapoptions]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CommitMapOptions(mapoptions)
}
}
return mapoptions
}
func (mapoptions *MapOptions) CommitVoid(stage *StageStruct) {
mapoptions.Commit(stage)
}
// Checkout mapoptions to the back repo (if it is already staged)
func (mapoptions *MapOptions) Checkout(stage *StageStruct) *MapOptions {
if _, ok := stage.MapOptionss[mapoptions]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CheckoutMapOptions(mapoptions)
}
}
return mapoptions
}
// for satisfaction of GongStruct interface
func (mapoptions *MapOptions) GetName() (res string) {
return mapoptions.Name
}
// Stage puts marker to the model stage
func (marker *Marker) Stage(stage *StageStruct) *Marker {
stage.Markers[marker] = __member
stage.Markers_mapString[marker.Name] = marker
return marker
}
// Unstage removes marker off the model stage
func (marker *Marker) Unstage(stage *StageStruct) *Marker {
delete(stage.Markers, marker)
delete(stage.Markers_mapString, marker.Name)
return marker
}
// UnstageVoid removes marker off the model stage
func (marker *Marker) UnstageVoid(stage *StageStruct) {
delete(stage.Markers, marker)
delete(stage.Markers_mapString, marker.Name)
}
// commit marker to the back repo (if it is already staged)
func (marker *Marker) Commit(stage *StageStruct) *Marker {
if _, ok := stage.Markers[marker]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CommitMarker(marker)
}
}
return marker
}
func (marker *Marker) CommitVoid(stage *StageStruct) {
marker.Commit(stage)
}
// Checkout marker to the back repo (if it is already staged)
func (marker *Marker) Checkout(stage *StageStruct) *Marker {
if _, ok := stage.Markers[marker]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CheckoutMarker(marker)
}
}
return marker
}
// for satisfaction of GongStruct interface
func (marker *Marker) GetName() (res string) {
return marker.Name
}
// Stage puts userclick to the model stage
func (userclick *UserClick) Stage(stage *StageStruct) *UserClick {
stage.UserClicks[userclick] = __member
stage.UserClicks_mapString[userclick.Name] = userclick
return userclick
}
// Unstage removes userclick off the model stage
func (userclick *UserClick) Unstage(stage *StageStruct) *UserClick {
delete(stage.UserClicks, userclick)
delete(stage.UserClicks_mapString, userclick.Name)
return userclick
}
// UnstageVoid removes userclick off the model stage
func (userclick *UserClick) UnstageVoid(stage *StageStruct) {
delete(stage.UserClicks, userclick)
delete(stage.UserClicks_mapString, userclick.Name)
}
// commit userclick to the back repo (if it is already staged)
func (userclick *UserClick) Commit(stage *StageStruct) *UserClick {
if _, ok := stage.UserClicks[userclick]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CommitUserClick(userclick)
}
}
return userclick
}
func (userclick *UserClick) CommitVoid(stage *StageStruct) {
userclick.Commit(stage)
}
// Checkout userclick to the back repo (if it is already staged)
func (userclick *UserClick) Checkout(stage *StageStruct) *UserClick {
if _, ok := stage.UserClicks[userclick]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CheckoutUserClick(userclick)
}
}
return userclick
}
// for satisfaction of GongStruct interface
func (userclick *UserClick) GetName() (res string) {
return userclick.Name
}
// Stage puts vline to the model stage
func (vline *VLine) Stage(stage *StageStruct) *VLine {
stage.VLines[vline] = __member
stage.VLines_mapString[vline.Name] = vline
return vline
}
// Unstage removes vline off the model stage
func (vline *VLine) Unstage(stage *StageStruct) *VLine {
delete(stage.VLines, vline)
delete(stage.VLines_mapString, vline.Name)
return vline
}
// UnstageVoid removes vline off the model stage
func (vline *VLine) UnstageVoid(stage *StageStruct) {
delete(stage.VLines, vline)
delete(stage.VLines_mapString, vline.Name)
}
// commit vline to the back repo (if it is already staged)
func (vline *VLine) Commit(stage *StageStruct) *VLine {
if _, ok := stage.VLines[vline]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CommitVLine(vline)
}
}
return vline
}
func (vline *VLine) CommitVoid(stage *StageStruct) {
vline.Commit(stage)
}
// Checkout vline to the back repo (if it is already staged)
func (vline *VLine) Checkout(stage *StageStruct) *VLine {
if _, ok := stage.VLines[vline]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CheckoutVLine(vline)
}
}
return vline
}
// for satisfaction of GongStruct interface
func (vline *VLine) GetName() (res string) {
return vline.Name
}
// Stage puts visualtrack to the model stage
func (visualtrack *VisualTrack) Stage(stage *StageStruct) *VisualTrack {
stage.VisualTracks[visualtrack] = __member
stage.VisualTracks_mapString[visualtrack.Name] = visualtrack
return visualtrack
}
// Unstage removes visualtrack off the model stage
func (visualtrack *VisualTrack) Unstage(stage *StageStruct) *VisualTrack {
delete(stage.VisualTracks, visualtrack)
delete(stage.VisualTracks_mapString, visualtrack.Name)
return visualtrack
}
// UnstageVoid removes visualtrack off the model stage
func (visualtrack *VisualTrack) UnstageVoid(stage *StageStruct) {
delete(stage.VisualTracks, visualtrack)
delete(stage.VisualTracks_mapString, visualtrack.Name)
}
// commit visualtrack to the back repo (if it is already staged)
func (visualtrack *VisualTrack) Commit(stage *StageStruct) *VisualTrack {
if _, ok := stage.VisualTracks[visualtrack]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CommitVisualTrack(visualtrack)
}
}
return visualtrack
}
func (visualtrack *VisualTrack) CommitVoid(stage *StageStruct) {
visualtrack.Commit(stage)
}
// Checkout visualtrack to the back repo (if it is already staged)
func (visualtrack *VisualTrack) Checkout(stage *StageStruct) *VisualTrack {
if _, ok := stage.VisualTracks[visualtrack]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CheckoutVisualTrack(visualtrack)
}
}
return visualtrack
}
// for satisfaction of GongStruct interface
func (visualtrack *VisualTrack) GetName() (res string) {
return visualtrack.Name
}
// swagger:ignore
type AllModelsStructCreateInterface interface { // insertion point for Callbacks on creation
CreateORMCircle(Circle *Circle)
CreateORMDivIcon(DivIcon *DivIcon)
CreateORMLayerGroup(LayerGroup *LayerGroup)
CreateORMLayerGroupUse(LayerGroupUse *LayerGroupUse)
CreateORMMapOptions(MapOptions *MapOptions)
CreateORMMarker(Marker *Marker)
CreateORMUserClick(UserClick *UserClick)
CreateORMVLine(VLine *VLine)
CreateORMVisualTrack(VisualTrack *VisualTrack)
}
type AllModelsStructDeleteInterface interface { // insertion point for Callbacks on deletion
DeleteORMCircle(Circle *Circle)
DeleteORMDivIcon(DivIcon *DivIcon)
DeleteORMLayerGroup(LayerGroup *LayerGroup)
DeleteORMLayerGroupUse(LayerGroupUse *LayerGroupUse)
DeleteORMMapOptions(MapOptions *MapOptions)
DeleteORMMarker(Marker *Marker)
DeleteORMUserClick(UserClick *UserClick)
DeleteORMVLine(VLine *VLine)
DeleteORMVisualTrack(VisualTrack *VisualTrack)
}
func (stage *StageStruct) Reset() { // insertion point for array reset
stage.Circles = make(map[*Circle]any)
stage.Circles_mapString = make(map[string]*Circle)
stage.DivIcons = make(map[*DivIcon]any)
stage.DivIcons_mapString = make(map[string]*DivIcon)
stage.LayerGroups = make(map[*LayerGroup]any)
stage.LayerGroups_mapString = make(map[string]*LayerGroup)
stage.LayerGroupUses = make(map[*LayerGroupUse]any)
stage.LayerGroupUses_mapString = make(map[string]*LayerGroupUse)
stage.MapOptionss = make(map[*MapOptions]any)
stage.MapOptionss_mapString = make(map[string]*MapOptions)
stage.Markers = make(map[*Marker]any)
stage.Markers_mapString = make(map[string]*Marker)
stage.UserClicks = make(map[*UserClick]any)
stage.UserClicks_mapString = make(map[string]*UserClick)
stage.VLines = make(map[*VLine]any)
stage.VLines_mapString = make(map[string]*VLine)
stage.VisualTracks = make(map[*VisualTrack]any)
stage.VisualTracks_mapString = make(map[string]*VisualTrack)
}
func (stage *StageStruct) Nil() { // insertion point for array nil
stage.Circles = nil
stage.Circles_mapString = nil
stage.DivIcons = nil
stage.DivIcons_mapString = nil
stage.LayerGroups = nil
stage.LayerGroups_mapString = nil
stage.LayerGroupUses = nil
stage.LayerGroupUses_mapString = nil
stage.MapOptionss = nil
stage.MapOptionss_mapString = nil
stage.Markers = nil
stage.Markers_mapString = nil
stage.UserClicks = nil
stage.UserClicks_mapString = nil
stage.VLines = nil
stage.VLines_mapString = nil
stage.VisualTracks = nil
stage.VisualTracks_mapString = nil
}
func (stage *StageStruct) Unstage() { // insertion point for array nil
for circle := range stage.Circles {
circle.Unstage(stage)
}
for divicon := range stage.DivIcons {
divicon.Unstage(stage)
}
for layergroup := range stage.LayerGroups {
layergroup.Unstage(stage)
}
for layergroupuse := range stage.LayerGroupUses {
layergroupuse.Unstage(stage)
}
for mapoptions := range stage.MapOptionss {
mapoptions.Unstage(stage)
}
for marker := range stage.Markers {
marker.Unstage(stage)
}
for userclick := range stage.UserClicks {
userclick.Unstage(stage)
}
for vline := range stage.VLines {
vline.Unstage(stage)
}
for visualtrack := range stage.VisualTracks {
visualtrack.Unstage(stage)
}
}
// Gongstruct is the type parameter for generated generic function that allows
// - access to staged instances
// - navigation between staged instances by going backward association links between gongstruct
// - full refactoring of Gongstruct identifiers / fields
type Gongstruct interface {
// insertion point for generic types
Circle | DivIcon | LayerGroup | LayerGroupUse | MapOptions | Marker | UserClick | VLine | VisualTrack
}
type GongtructBasicField interface {
int | float64 | bool | string | time.Time | time.Duration
}
// Gongstruct is the type parameter for generated generic function that allows
// - access to staged instances
// - navigation between staged instances by going backward association links between gongstruct
// - full refactoring of Gongstruct identifiers / fields
type PointerToGongstruct interface {
// insertion point for generic types
*Circle | *DivIcon | *LayerGroup | *LayerGroupUse | *MapOptions | *Marker | *UserClick | *VLine | *VisualTrack
GetName() string
CommitVoid(*StageStruct)
UnstageVoid(stage *StageStruct)
}
func CompareGongstructByName[T PointerToGongstruct](a, b T) int {
return cmp.Compare(a.GetName(), b.GetName())
}
func SortGongstructSetByName[T PointerToGongstruct](set map[T]any) (sortedSlice []T) {
sortedSlice = maps.Keys(set)
slices.SortFunc(sortedSlice, CompareGongstructByName)
return
}
func GetGongstrucsSorted[T PointerToGongstruct](stage *StageStruct) (sortedSlice []T) {
set := GetGongstructInstancesSetFromPointerType[T](stage)
sortedSlice = SortGongstructSetByName(*set)
return
}
type GongstructSet interface {
map[any]any |
// insertion point for generic types
map[*Circle]any |
map[*DivIcon]any |
map[*LayerGroup]any |
map[*LayerGroupUse]any |
map[*MapOptions]any |
map[*Marker]any |
map[*UserClick]any |
map[*VLine]any |
map[*VisualTrack]any |
map[*any]any // because go does not support an extra "|" at the end of type specifications
}
type GongstructMapString interface {
map[any]any |
// insertion point for generic types
map[string]*Circle |
map[string]*DivIcon |
map[string]*LayerGroup |
map[string]*LayerGroupUse |
map[string]*MapOptions |
map[string]*Marker |
map[string]*UserClick |
map[string]*VLine |