-
Notifications
You must be signed in to change notification settings - Fork 101
/
memory.cosmos_orm.go
641 lines (510 loc) · 27.5 KB
/
memory.cosmos_orm.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
// Code generated by protoc-gen-go-cosmos-orm. DO NOT EDIT.
package orderbookv1alpha1
import (
context "context"
ormlist "github.com/cosmos/cosmos-sdk/orm/model/ormlist"
ormtable "github.com/cosmos/cosmos-sdk/orm/model/ormtable"
ormerrors "github.com/cosmos/cosmos-sdk/orm/types/ormerrors"
)
type BuyOrderSellOrderMatchTable interface {
Insert(ctx context.Context, buyOrderSellOrderMatch *BuyOrderSellOrderMatch) error
Update(ctx context.Context, buyOrderSellOrderMatch *BuyOrderSellOrderMatch) error
Save(ctx context.Context, buyOrderSellOrderMatch *BuyOrderSellOrderMatch) error
Delete(ctx context.Context, buyOrderSellOrderMatch *BuyOrderSellOrderMatch) error
Has(ctx context.Context, buy_order_id uint64, sell_order_id uint64) (found bool, err error)
// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
Get(ctx context.Context, buy_order_id uint64, sell_order_id uint64) (*BuyOrderSellOrderMatch, error)
List(ctx context.Context, prefixKey BuyOrderSellOrderMatchIndexKey, opts ...ormlist.Option) (BuyOrderSellOrderMatchIterator, error)
ListRange(ctx context.Context, from, to BuyOrderSellOrderMatchIndexKey, opts ...ormlist.Option) (BuyOrderSellOrderMatchIterator, error)
DeleteBy(ctx context.Context, prefixKey BuyOrderSellOrderMatchIndexKey) error
DeleteRange(ctx context.Context, from, to BuyOrderSellOrderMatchIndexKey) error
doNotImplement()
}
type BuyOrderSellOrderMatchIterator struct {
ormtable.Iterator
}
func (i BuyOrderSellOrderMatchIterator) Value() (*BuyOrderSellOrderMatch, error) {
var buyOrderSellOrderMatch BuyOrderSellOrderMatch
err := i.UnmarshalMessage(&buyOrderSellOrderMatch)
return &buyOrderSellOrderMatch, err
}
type BuyOrderSellOrderMatchIndexKey interface {
id() uint32
values() []interface{}
buyOrderSellOrderMatchIndexKey()
}
// primary key starting index..
type BuyOrderSellOrderMatchPrimaryKey = BuyOrderSellOrderMatchBuyOrderIdSellOrderIdIndexKey
type BuyOrderSellOrderMatchBuyOrderIdSellOrderIdIndexKey struct {
vs []interface{}
}
func (x BuyOrderSellOrderMatchBuyOrderIdSellOrderIdIndexKey) id() uint32 { return 0 }
func (x BuyOrderSellOrderMatchBuyOrderIdSellOrderIdIndexKey) values() []interface{} { return x.vs }
func (x BuyOrderSellOrderMatchBuyOrderIdSellOrderIdIndexKey) buyOrderSellOrderMatchIndexKey() {}
func (this BuyOrderSellOrderMatchBuyOrderIdSellOrderIdIndexKey) WithBuyOrderId(buy_order_id uint64) BuyOrderSellOrderMatchBuyOrderIdSellOrderIdIndexKey {
this.vs = []interface{}{buy_order_id}
return this
}
func (this BuyOrderSellOrderMatchBuyOrderIdSellOrderIdIndexKey) WithBuyOrderIdSellOrderId(buy_order_id uint64, sell_order_id uint64) BuyOrderSellOrderMatchBuyOrderIdSellOrderIdIndexKey {
this.vs = []interface{}{buy_order_id, sell_order_id}
return this
}
type BuyOrderSellOrderMatchMarketIdBidPriceComplementBuyOrderIdAskPriceSellOrderIdIndexKey struct {
vs []interface{}
}
func (x BuyOrderSellOrderMatchMarketIdBidPriceComplementBuyOrderIdAskPriceSellOrderIdIndexKey) id() uint32 {
return 1
}
func (x BuyOrderSellOrderMatchMarketIdBidPriceComplementBuyOrderIdAskPriceSellOrderIdIndexKey) values() []interface{} {
return x.vs
}
func (x BuyOrderSellOrderMatchMarketIdBidPriceComplementBuyOrderIdAskPriceSellOrderIdIndexKey) buyOrderSellOrderMatchIndexKey() {
}
func (this BuyOrderSellOrderMatchMarketIdBidPriceComplementBuyOrderIdAskPriceSellOrderIdIndexKey) WithMarketId(market_id uint64) BuyOrderSellOrderMatchMarketIdBidPriceComplementBuyOrderIdAskPriceSellOrderIdIndexKey {
this.vs = []interface{}{market_id}
return this
}
func (this BuyOrderSellOrderMatchMarketIdBidPriceComplementBuyOrderIdAskPriceSellOrderIdIndexKey) WithMarketIdBidPriceComplement(market_id uint64, bid_price_complement uint32) BuyOrderSellOrderMatchMarketIdBidPriceComplementBuyOrderIdAskPriceSellOrderIdIndexKey {
this.vs = []interface{}{market_id, bid_price_complement}
return this
}
func (this BuyOrderSellOrderMatchMarketIdBidPriceComplementBuyOrderIdAskPriceSellOrderIdIndexKey) WithMarketIdBidPriceComplementBuyOrderId(market_id uint64, bid_price_complement uint32, buy_order_id uint64) BuyOrderSellOrderMatchMarketIdBidPriceComplementBuyOrderIdAskPriceSellOrderIdIndexKey {
this.vs = []interface{}{market_id, bid_price_complement, buy_order_id}
return this
}
func (this BuyOrderSellOrderMatchMarketIdBidPriceComplementBuyOrderIdAskPriceSellOrderIdIndexKey) WithMarketIdBidPriceComplementBuyOrderIdAskPrice(market_id uint64, bid_price_complement uint32, buy_order_id uint64, ask_price uint32) BuyOrderSellOrderMatchMarketIdBidPriceComplementBuyOrderIdAskPriceSellOrderIdIndexKey {
this.vs = []interface{}{market_id, bid_price_complement, buy_order_id, ask_price}
return this
}
func (this BuyOrderSellOrderMatchMarketIdBidPriceComplementBuyOrderIdAskPriceSellOrderIdIndexKey) WithMarketIdBidPriceComplementBuyOrderIdAskPriceSellOrderId(market_id uint64, bid_price_complement uint32, buy_order_id uint64, ask_price uint32, sell_order_id uint64) BuyOrderSellOrderMatchMarketIdBidPriceComplementBuyOrderIdAskPriceSellOrderIdIndexKey {
this.vs = []interface{}{market_id, bid_price_complement, buy_order_id, ask_price, sell_order_id}
return this
}
type BuyOrderSellOrderMatchSellOrderIdIndexKey struct {
vs []interface{}
}
func (x BuyOrderSellOrderMatchSellOrderIdIndexKey) id() uint32 { return 2 }
func (x BuyOrderSellOrderMatchSellOrderIdIndexKey) values() []interface{} { return x.vs }
func (x BuyOrderSellOrderMatchSellOrderIdIndexKey) buyOrderSellOrderMatchIndexKey() {}
func (this BuyOrderSellOrderMatchSellOrderIdIndexKey) WithSellOrderId(sell_order_id uint64) BuyOrderSellOrderMatchSellOrderIdIndexKey {
this.vs = []interface{}{sell_order_id}
return this
}
type buyOrderSellOrderMatchTable struct {
table ormtable.Table
}
func (this buyOrderSellOrderMatchTable) Insert(ctx context.Context, buyOrderSellOrderMatch *BuyOrderSellOrderMatch) error {
return this.table.Insert(ctx, buyOrderSellOrderMatch)
}
func (this buyOrderSellOrderMatchTable) Update(ctx context.Context, buyOrderSellOrderMatch *BuyOrderSellOrderMatch) error {
return this.table.Update(ctx, buyOrderSellOrderMatch)
}
func (this buyOrderSellOrderMatchTable) Save(ctx context.Context, buyOrderSellOrderMatch *BuyOrderSellOrderMatch) error {
return this.table.Save(ctx, buyOrderSellOrderMatch)
}
func (this buyOrderSellOrderMatchTable) Delete(ctx context.Context, buyOrderSellOrderMatch *BuyOrderSellOrderMatch) error {
return this.table.Delete(ctx, buyOrderSellOrderMatch)
}
func (this buyOrderSellOrderMatchTable) Has(ctx context.Context, buy_order_id uint64, sell_order_id uint64) (found bool, err error) {
return this.table.PrimaryKey().Has(ctx, buy_order_id, sell_order_id)
}
func (this buyOrderSellOrderMatchTable) Get(ctx context.Context, buy_order_id uint64, sell_order_id uint64) (*BuyOrderSellOrderMatch, error) {
var buyOrderSellOrderMatch BuyOrderSellOrderMatch
found, err := this.table.PrimaryKey().Get(ctx, &buyOrderSellOrderMatch, buy_order_id, sell_order_id)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &buyOrderSellOrderMatch, nil
}
func (this buyOrderSellOrderMatchTable) List(ctx context.Context, prefixKey BuyOrderSellOrderMatchIndexKey, opts ...ormlist.Option) (BuyOrderSellOrderMatchIterator, error) {
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
return BuyOrderSellOrderMatchIterator{it}, err
}
func (this buyOrderSellOrderMatchTable) ListRange(ctx context.Context, from, to BuyOrderSellOrderMatchIndexKey, opts ...ormlist.Option) (BuyOrderSellOrderMatchIterator, error) {
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
return BuyOrderSellOrderMatchIterator{it}, err
}
func (this buyOrderSellOrderMatchTable) DeleteBy(ctx context.Context, prefixKey BuyOrderSellOrderMatchIndexKey) error {
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
}
func (this buyOrderSellOrderMatchTable) DeleteRange(ctx context.Context, from, to BuyOrderSellOrderMatchIndexKey) error {
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
}
func (this buyOrderSellOrderMatchTable) doNotImplement() {}
var _ BuyOrderSellOrderMatchTable = buyOrderSellOrderMatchTable{}
func NewBuyOrderSellOrderMatchTable(db ormtable.Schema) (BuyOrderSellOrderMatchTable, error) {
table := db.GetTable(&BuyOrderSellOrderMatch{})
if table == nil {
return nil, ormerrors.TableNotFound.Wrap(string((&BuyOrderSellOrderMatch{}).ProtoReflect().Descriptor().FullName()))
}
return buyOrderSellOrderMatchTable{table}, nil
}
type BuyOrderClassSelectorTable interface {
Insert(ctx context.Context, buyOrderClassSelector *BuyOrderClassSelector) error
Update(ctx context.Context, buyOrderClassSelector *BuyOrderClassSelector) error
Save(ctx context.Context, buyOrderClassSelector *BuyOrderClassSelector) error
Delete(ctx context.Context, buyOrderClassSelector *BuyOrderClassSelector) error
Has(ctx context.Context, buy_order_id uint64, class_id uint64) (found bool, err error)
// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
Get(ctx context.Context, buy_order_id uint64, class_id uint64) (*BuyOrderClassSelector, error)
List(ctx context.Context, prefixKey BuyOrderClassSelectorIndexKey, opts ...ormlist.Option) (BuyOrderClassSelectorIterator, error)
ListRange(ctx context.Context, from, to BuyOrderClassSelectorIndexKey, opts ...ormlist.Option) (BuyOrderClassSelectorIterator, error)
DeleteBy(ctx context.Context, prefixKey BuyOrderClassSelectorIndexKey) error
DeleteRange(ctx context.Context, from, to BuyOrderClassSelectorIndexKey) error
doNotImplement()
}
type BuyOrderClassSelectorIterator struct {
ormtable.Iterator
}
func (i BuyOrderClassSelectorIterator) Value() (*BuyOrderClassSelector, error) {
var buyOrderClassSelector BuyOrderClassSelector
err := i.UnmarshalMessage(&buyOrderClassSelector)
return &buyOrderClassSelector, err
}
type BuyOrderClassSelectorIndexKey interface {
id() uint32
values() []interface{}
buyOrderClassSelectorIndexKey()
}
// primary key starting index..
type BuyOrderClassSelectorPrimaryKey = BuyOrderClassSelectorBuyOrderIdClassIdIndexKey
type BuyOrderClassSelectorBuyOrderIdClassIdIndexKey struct {
vs []interface{}
}
func (x BuyOrderClassSelectorBuyOrderIdClassIdIndexKey) id() uint32 { return 0 }
func (x BuyOrderClassSelectorBuyOrderIdClassIdIndexKey) values() []interface{} { return x.vs }
func (x BuyOrderClassSelectorBuyOrderIdClassIdIndexKey) buyOrderClassSelectorIndexKey() {}
func (this BuyOrderClassSelectorBuyOrderIdClassIdIndexKey) WithBuyOrderId(buy_order_id uint64) BuyOrderClassSelectorBuyOrderIdClassIdIndexKey {
this.vs = []interface{}{buy_order_id}
return this
}
func (this BuyOrderClassSelectorBuyOrderIdClassIdIndexKey) WithBuyOrderIdClassId(buy_order_id uint64, class_id uint64) BuyOrderClassSelectorBuyOrderIdClassIdIndexKey {
this.vs = []interface{}{buy_order_id, class_id}
return this
}
type BuyOrderClassSelectorClassIdIndexKey struct {
vs []interface{}
}
func (x BuyOrderClassSelectorClassIdIndexKey) id() uint32 { return 1 }
func (x BuyOrderClassSelectorClassIdIndexKey) values() []interface{} { return x.vs }
func (x BuyOrderClassSelectorClassIdIndexKey) buyOrderClassSelectorIndexKey() {}
func (this BuyOrderClassSelectorClassIdIndexKey) WithClassId(class_id uint64) BuyOrderClassSelectorClassIdIndexKey {
this.vs = []interface{}{class_id}
return this
}
type buyOrderClassSelectorTable struct {
table ormtable.Table
}
func (this buyOrderClassSelectorTable) Insert(ctx context.Context, buyOrderClassSelector *BuyOrderClassSelector) error {
return this.table.Insert(ctx, buyOrderClassSelector)
}
func (this buyOrderClassSelectorTable) Update(ctx context.Context, buyOrderClassSelector *BuyOrderClassSelector) error {
return this.table.Update(ctx, buyOrderClassSelector)
}
func (this buyOrderClassSelectorTable) Save(ctx context.Context, buyOrderClassSelector *BuyOrderClassSelector) error {
return this.table.Save(ctx, buyOrderClassSelector)
}
func (this buyOrderClassSelectorTable) Delete(ctx context.Context, buyOrderClassSelector *BuyOrderClassSelector) error {
return this.table.Delete(ctx, buyOrderClassSelector)
}
func (this buyOrderClassSelectorTable) Has(ctx context.Context, buy_order_id uint64, class_id uint64) (found bool, err error) {
return this.table.PrimaryKey().Has(ctx, buy_order_id, class_id)
}
func (this buyOrderClassSelectorTable) Get(ctx context.Context, buy_order_id uint64, class_id uint64) (*BuyOrderClassSelector, error) {
var buyOrderClassSelector BuyOrderClassSelector
found, err := this.table.PrimaryKey().Get(ctx, &buyOrderClassSelector, buy_order_id, class_id)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &buyOrderClassSelector, nil
}
func (this buyOrderClassSelectorTable) List(ctx context.Context, prefixKey BuyOrderClassSelectorIndexKey, opts ...ormlist.Option) (BuyOrderClassSelectorIterator, error) {
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
return BuyOrderClassSelectorIterator{it}, err
}
func (this buyOrderClassSelectorTable) ListRange(ctx context.Context, from, to BuyOrderClassSelectorIndexKey, opts ...ormlist.Option) (BuyOrderClassSelectorIterator, error) {
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
return BuyOrderClassSelectorIterator{it}, err
}
func (this buyOrderClassSelectorTable) DeleteBy(ctx context.Context, prefixKey BuyOrderClassSelectorIndexKey) error {
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
}
func (this buyOrderClassSelectorTable) DeleteRange(ctx context.Context, from, to BuyOrderClassSelectorIndexKey) error {
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
}
func (this buyOrderClassSelectorTable) doNotImplement() {}
var _ BuyOrderClassSelectorTable = buyOrderClassSelectorTable{}
func NewBuyOrderClassSelectorTable(db ormtable.Schema) (BuyOrderClassSelectorTable, error) {
table := db.GetTable(&BuyOrderClassSelector{})
if table == nil {
return nil, ormerrors.TableNotFound.Wrap(string((&BuyOrderClassSelector{}).ProtoReflect().Descriptor().FullName()))
}
return buyOrderClassSelectorTable{table}, nil
}
type BuyOrderProjectSelectorTable interface {
Insert(ctx context.Context, buyOrderProjectSelector *BuyOrderProjectSelector) error
Update(ctx context.Context, buyOrderProjectSelector *BuyOrderProjectSelector) error
Save(ctx context.Context, buyOrderProjectSelector *BuyOrderProjectSelector) error
Delete(ctx context.Context, buyOrderProjectSelector *BuyOrderProjectSelector) error
Has(ctx context.Context, buy_order_id uint64, project_id uint64) (found bool, err error)
// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
Get(ctx context.Context, buy_order_id uint64, project_id uint64) (*BuyOrderProjectSelector, error)
List(ctx context.Context, prefixKey BuyOrderProjectSelectorIndexKey, opts ...ormlist.Option) (BuyOrderProjectSelectorIterator, error)
ListRange(ctx context.Context, from, to BuyOrderProjectSelectorIndexKey, opts ...ormlist.Option) (BuyOrderProjectSelectorIterator, error)
DeleteBy(ctx context.Context, prefixKey BuyOrderProjectSelectorIndexKey) error
DeleteRange(ctx context.Context, from, to BuyOrderProjectSelectorIndexKey) error
doNotImplement()
}
type BuyOrderProjectSelectorIterator struct {
ormtable.Iterator
}
func (i BuyOrderProjectSelectorIterator) Value() (*BuyOrderProjectSelector, error) {
var buyOrderProjectSelector BuyOrderProjectSelector
err := i.UnmarshalMessage(&buyOrderProjectSelector)
return &buyOrderProjectSelector, err
}
type BuyOrderProjectSelectorIndexKey interface {
id() uint32
values() []interface{}
buyOrderProjectSelectorIndexKey()
}
// primary key starting index..
type BuyOrderProjectSelectorPrimaryKey = BuyOrderProjectSelectorBuyOrderIdProjectIdIndexKey
type BuyOrderProjectSelectorBuyOrderIdProjectIdIndexKey struct {
vs []interface{}
}
func (x BuyOrderProjectSelectorBuyOrderIdProjectIdIndexKey) id() uint32 { return 0 }
func (x BuyOrderProjectSelectorBuyOrderIdProjectIdIndexKey) values() []interface{} { return x.vs }
func (x BuyOrderProjectSelectorBuyOrderIdProjectIdIndexKey) buyOrderProjectSelectorIndexKey() {}
func (this BuyOrderProjectSelectorBuyOrderIdProjectIdIndexKey) WithBuyOrderId(buy_order_id uint64) BuyOrderProjectSelectorBuyOrderIdProjectIdIndexKey {
this.vs = []interface{}{buy_order_id}
return this
}
func (this BuyOrderProjectSelectorBuyOrderIdProjectIdIndexKey) WithBuyOrderIdProjectId(buy_order_id uint64, project_id uint64) BuyOrderProjectSelectorBuyOrderIdProjectIdIndexKey {
this.vs = []interface{}{buy_order_id, project_id}
return this
}
type BuyOrderProjectSelectorProjectIdIndexKey struct {
vs []interface{}
}
func (x BuyOrderProjectSelectorProjectIdIndexKey) id() uint32 { return 1 }
func (x BuyOrderProjectSelectorProjectIdIndexKey) values() []interface{} { return x.vs }
func (x BuyOrderProjectSelectorProjectIdIndexKey) buyOrderProjectSelectorIndexKey() {}
func (this BuyOrderProjectSelectorProjectIdIndexKey) WithProjectId(project_id uint64) BuyOrderProjectSelectorProjectIdIndexKey {
this.vs = []interface{}{project_id}
return this
}
type buyOrderProjectSelectorTable struct {
table ormtable.Table
}
func (this buyOrderProjectSelectorTable) Insert(ctx context.Context, buyOrderProjectSelector *BuyOrderProjectSelector) error {
return this.table.Insert(ctx, buyOrderProjectSelector)
}
func (this buyOrderProjectSelectorTable) Update(ctx context.Context, buyOrderProjectSelector *BuyOrderProjectSelector) error {
return this.table.Update(ctx, buyOrderProjectSelector)
}
func (this buyOrderProjectSelectorTable) Save(ctx context.Context, buyOrderProjectSelector *BuyOrderProjectSelector) error {
return this.table.Save(ctx, buyOrderProjectSelector)
}
func (this buyOrderProjectSelectorTable) Delete(ctx context.Context, buyOrderProjectSelector *BuyOrderProjectSelector) error {
return this.table.Delete(ctx, buyOrderProjectSelector)
}
func (this buyOrderProjectSelectorTable) Has(ctx context.Context, buy_order_id uint64, project_id uint64) (found bool, err error) {
return this.table.PrimaryKey().Has(ctx, buy_order_id, project_id)
}
func (this buyOrderProjectSelectorTable) Get(ctx context.Context, buy_order_id uint64, project_id uint64) (*BuyOrderProjectSelector, error) {
var buyOrderProjectSelector BuyOrderProjectSelector
found, err := this.table.PrimaryKey().Get(ctx, &buyOrderProjectSelector, buy_order_id, project_id)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &buyOrderProjectSelector, nil
}
func (this buyOrderProjectSelectorTable) List(ctx context.Context, prefixKey BuyOrderProjectSelectorIndexKey, opts ...ormlist.Option) (BuyOrderProjectSelectorIterator, error) {
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
return BuyOrderProjectSelectorIterator{it}, err
}
func (this buyOrderProjectSelectorTable) ListRange(ctx context.Context, from, to BuyOrderProjectSelectorIndexKey, opts ...ormlist.Option) (BuyOrderProjectSelectorIterator, error) {
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
return BuyOrderProjectSelectorIterator{it}, err
}
func (this buyOrderProjectSelectorTable) DeleteBy(ctx context.Context, prefixKey BuyOrderProjectSelectorIndexKey) error {
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
}
func (this buyOrderProjectSelectorTable) DeleteRange(ctx context.Context, from, to BuyOrderProjectSelectorIndexKey) error {
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
}
func (this buyOrderProjectSelectorTable) doNotImplement() {}
var _ BuyOrderProjectSelectorTable = buyOrderProjectSelectorTable{}
func NewBuyOrderProjectSelectorTable(db ormtable.Schema) (BuyOrderProjectSelectorTable, error) {
table := db.GetTable(&BuyOrderProjectSelector{})
if table == nil {
return nil, ormerrors.TableNotFound.Wrap(string((&BuyOrderProjectSelector{}).ProtoReflect().Descriptor().FullName()))
}
return buyOrderProjectSelectorTable{table}, nil
}
type BuyOrderBatchSelectorTable interface {
Insert(ctx context.Context, buyOrderBatchSelector *BuyOrderBatchSelector) error
Update(ctx context.Context, buyOrderBatchSelector *BuyOrderBatchSelector) error
Save(ctx context.Context, buyOrderBatchSelector *BuyOrderBatchSelector) error
Delete(ctx context.Context, buyOrderBatchSelector *BuyOrderBatchSelector) error
Has(ctx context.Context, buy_order_id uint64, batch_id uint64) (found bool, err error)
// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
Get(ctx context.Context, buy_order_id uint64, batch_id uint64) (*BuyOrderBatchSelector, error)
List(ctx context.Context, prefixKey BuyOrderBatchSelectorIndexKey, opts ...ormlist.Option) (BuyOrderBatchSelectorIterator, error)
ListRange(ctx context.Context, from, to BuyOrderBatchSelectorIndexKey, opts ...ormlist.Option) (BuyOrderBatchSelectorIterator, error)
DeleteBy(ctx context.Context, prefixKey BuyOrderBatchSelectorIndexKey) error
DeleteRange(ctx context.Context, from, to BuyOrderBatchSelectorIndexKey) error
doNotImplement()
}
type BuyOrderBatchSelectorIterator struct {
ormtable.Iterator
}
func (i BuyOrderBatchSelectorIterator) Value() (*BuyOrderBatchSelector, error) {
var buyOrderBatchSelector BuyOrderBatchSelector
err := i.UnmarshalMessage(&buyOrderBatchSelector)
return &buyOrderBatchSelector, err
}
type BuyOrderBatchSelectorIndexKey interface {
id() uint32
values() []interface{}
buyOrderBatchSelectorIndexKey()
}
// primary key starting index..
type BuyOrderBatchSelectorPrimaryKey = BuyOrderBatchSelectorBuyOrderIdBatchIdIndexKey
type BuyOrderBatchSelectorBuyOrderIdBatchIdIndexKey struct {
vs []interface{}
}
func (x BuyOrderBatchSelectorBuyOrderIdBatchIdIndexKey) id() uint32 { return 0 }
func (x BuyOrderBatchSelectorBuyOrderIdBatchIdIndexKey) values() []interface{} { return x.vs }
func (x BuyOrderBatchSelectorBuyOrderIdBatchIdIndexKey) buyOrderBatchSelectorIndexKey() {}
func (this BuyOrderBatchSelectorBuyOrderIdBatchIdIndexKey) WithBuyOrderId(buy_order_id uint64) BuyOrderBatchSelectorBuyOrderIdBatchIdIndexKey {
this.vs = []interface{}{buy_order_id}
return this
}
func (this BuyOrderBatchSelectorBuyOrderIdBatchIdIndexKey) WithBuyOrderIdBatchId(buy_order_id uint64, batch_id uint64) BuyOrderBatchSelectorBuyOrderIdBatchIdIndexKey {
this.vs = []interface{}{buy_order_id, batch_id}
return this
}
type BuyOrderBatchSelectorBatchIdIndexKey struct {
vs []interface{}
}
func (x BuyOrderBatchSelectorBatchIdIndexKey) id() uint32 { return 1 }
func (x BuyOrderBatchSelectorBatchIdIndexKey) values() []interface{} { return x.vs }
func (x BuyOrderBatchSelectorBatchIdIndexKey) buyOrderBatchSelectorIndexKey() {}
func (this BuyOrderBatchSelectorBatchIdIndexKey) WithBatchId(batch_id uint64) BuyOrderBatchSelectorBatchIdIndexKey {
this.vs = []interface{}{batch_id}
return this
}
type buyOrderBatchSelectorTable struct {
table ormtable.Table
}
func (this buyOrderBatchSelectorTable) Insert(ctx context.Context, buyOrderBatchSelector *BuyOrderBatchSelector) error {
return this.table.Insert(ctx, buyOrderBatchSelector)
}
func (this buyOrderBatchSelectorTable) Update(ctx context.Context, buyOrderBatchSelector *BuyOrderBatchSelector) error {
return this.table.Update(ctx, buyOrderBatchSelector)
}
func (this buyOrderBatchSelectorTable) Save(ctx context.Context, buyOrderBatchSelector *BuyOrderBatchSelector) error {
return this.table.Save(ctx, buyOrderBatchSelector)
}
func (this buyOrderBatchSelectorTable) Delete(ctx context.Context, buyOrderBatchSelector *BuyOrderBatchSelector) error {
return this.table.Delete(ctx, buyOrderBatchSelector)
}
func (this buyOrderBatchSelectorTable) Has(ctx context.Context, buy_order_id uint64, batch_id uint64) (found bool, err error) {
return this.table.PrimaryKey().Has(ctx, buy_order_id, batch_id)
}
func (this buyOrderBatchSelectorTable) Get(ctx context.Context, buy_order_id uint64, batch_id uint64) (*BuyOrderBatchSelector, error) {
var buyOrderBatchSelector BuyOrderBatchSelector
found, err := this.table.PrimaryKey().Get(ctx, &buyOrderBatchSelector, buy_order_id, batch_id)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &buyOrderBatchSelector, nil
}
func (this buyOrderBatchSelectorTable) List(ctx context.Context, prefixKey BuyOrderBatchSelectorIndexKey, opts ...ormlist.Option) (BuyOrderBatchSelectorIterator, error) {
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
return BuyOrderBatchSelectorIterator{it}, err
}
func (this buyOrderBatchSelectorTable) ListRange(ctx context.Context, from, to BuyOrderBatchSelectorIndexKey, opts ...ormlist.Option) (BuyOrderBatchSelectorIterator, error) {
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
return BuyOrderBatchSelectorIterator{it}, err
}
func (this buyOrderBatchSelectorTable) DeleteBy(ctx context.Context, prefixKey BuyOrderBatchSelectorIndexKey) error {
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
}
func (this buyOrderBatchSelectorTable) DeleteRange(ctx context.Context, from, to BuyOrderBatchSelectorIndexKey) error {
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
}
func (this buyOrderBatchSelectorTable) doNotImplement() {}
var _ BuyOrderBatchSelectorTable = buyOrderBatchSelectorTable{}
func NewBuyOrderBatchSelectorTable(db ormtable.Schema) (BuyOrderBatchSelectorTable, error) {
table := db.GetTable(&BuyOrderBatchSelector{})
if table == nil {
return nil, ormerrors.TableNotFound.Wrap(string((&BuyOrderBatchSelector{}).ProtoReflect().Descriptor().FullName()))
}
return buyOrderBatchSelectorTable{table}, nil
}
type MemoryStore interface {
BuyOrderSellOrderMatchTable() BuyOrderSellOrderMatchTable
BuyOrderClassSelectorTable() BuyOrderClassSelectorTable
BuyOrderProjectSelectorTable() BuyOrderProjectSelectorTable
BuyOrderBatchSelectorTable() BuyOrderBatchSelectorTable
doNotImplement()
}
type memoryStore struct {
buyOrderSellOrderMatch BuyOrderSellOrderMatchTable
buyOrderClassSelector BuyOrderClassSelectorTable
buyOrderProjectSelector BuyOrderProjectSelectorTable
buyOrderBatchSelector BuyOrderBatchSelectorTable
}
func (x memoryStore) BuyOrderSellOrderMatchTable() BuyOrderSellOrderMatchTable {
return x.buyOrderSellOrderMatch
}
func (x memoryStore) BuyOrderClassSelectorTable() BuyOrderClassSelectorTable {
return x.buyOrderClassSelector
}
func (x memoryStore) BuyOrderProjectSelectorTable() BuyOrderProjectSelectorTable {
return x.buyOrderProjectSelector
}
func (x memoryStore) BuyOrderBatchSelectorTable() BuyOrderBatchSelectorTable {
return x.buyOrderBatchSelector
}
func (memoryStore) doNotImplement() {}
var _ MemoryStore = memoryStore{}
func NewMemoryStore(db ormtable.Schema) (MemoryStore, error) {
buyOrderSellOrderMatchTable, err := NewBuyOrderSellOrderMatchTable(db)
if err != nil {
return nil, err
}
buyOrderClassSelectorTable, err := NewBuyOrderClassSelectorTable(db)
if err != nil {
return nil, err
}
buyOrderProjectSelectorTable, err := NewBuyOrderProjectSelectorTable(db)
if err != nil {
return nil, err
}
buyOrderBatchSelectorTable, err := NewBuyOrderBatchSelectorTable(db)
if err != nil {
return nil, err
}
return memoryStore{
buyOrderSellOrderMatchTable,
buyOrderClassSelectorTable,
buyOrderProjectSelectorTable,
buyOrderBatchSelectorTable,
}, nil
}