-
Notifications
You must be signed in to change notification settings - Fork 5
/
connector_mock_test.go
1442 lines (1127 loc) · 44.4 KB
/
connector_mock_test.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
package prep
/*
DO NOT EDIT!
This code was generated automatically using github.com/gojuno/minimock v1.8
The original interface "Connector" can be found in github.com/hexdigest/prep
*/
import (
context "context"
sql "database/sql"
driver "database/sql/driver"
"sync/atomic"
time "time"
"github.com/gojuno/minimock"
testify_assert "github.com/stretchr/testify/assert"
)
//ConnectorMock implements github.com/hexdigest/prep.Connector
type ConnectorMock struct {
t minimock.Tester
BeginFunc func() (r *sql.Tx, r1 error)
BeginCounter uint64
BeginMock mConnectorMockBegin
BeginTxFunc func(p context.Context, p1 *sql.TxOptions) (r *sql.Tx, r1 error)
BeginTxCounter uint64
BeginTxMock mConnectorMockBeginTx
CloseFunc func() (r error)
CloseCounter uint64
CloseMock mConnectorMockClose
DriverFunc func() (r driver.Driver)
DriverCounter uint64
DriverMock mConnectorMockDriver
ExecFunc func(p string, p1 ...interface{}) (r sql.Result, r1 error)
ExecCounter uint64
ExecMock mConnectorMockExec
ExecContextFunc func(p context.Context, p1 string, p2 ...interface{}) (r sql.Result, r1 error)
ExecContextCounter uint64
ExecContextMock mConnectorMockExecContext
PingFunc func() (r error)
PingCounter uint64
PingMock mConnectorMockPing
PingContextFunc func(p context.Context) (r error)
PingContextCounter uint64
PingContextMock mConnectorMockPingContext
PrepareFunc func(p string) (r *sql.Stmt, r1 error)
PrepareCounter uint64
PrepareMock mConnectorMockPrepare
PrepareContextFunc func(p context.Context, p1 string) (r *sql.Stmt, r1 error)
PrepareContextCounter uint64
PrepareContextMock mConnectorMockPrepareContext
QueryFunc func(p string, p1 ...interface{}) (r *sql.Rows, r1 error)
QueryCounter uint64
QueryMock mConnectorMockQuery
QueryContextFunc func(p context.Context, p1 string, p2 ...interface{}) (r *sql.Rows, r1 error)
QueryContextCounter uint64
QueryContextMock mConnectorMockQueryContext
QueryRowFunc func(p string, p1 ...interface{}) (r *sql.Row)
QueryRowCounter uint64
QueryRowMock mConnectorMockQueryRow
QueryRowContextFunc func(p context.Context, p1 string, p2 ...interface{}) (r *sql.Row)
QueryRowContextCounter uint64
QueryRowContextMock mConnectorMockQueryRowContext
SetConnMaxLifetimeFunc func(p time.Duration)
SetConnMaxLifetimeCounter uint64
SetConnMaxLifetimeMock mConnectorMockSetConnMaxLifetime
SetMaxIdleConnsFunc func(p int)
SetMaxIdleConnsCounter uint64
SetMaxIdleConnsMock mConnectorMockSetMaxIdleConns
SetMaxOpenConnsFunc func(p int)
SetMaxOpenConnsCounter uint64
SetMaxOpenConnsMock mConnectorMockSetMaxOpenConns
StatsFunc func() (r sql.DBStats)
StatsCounter uint64
StatsMock mConnectorMockStats
}
//NewConnectorMock returns a mock for github.com/hexdigest/prep.Connector
func NewConnectorMock(t minimock.Tester) *ConnectorMock {
m := &ConnectorMock{t: t}
if controller, ok := t.(minimock.MockController); ok {
controller.RegisterMocker(m)
}
m.BeginMock = mConnectorMockBegin{mock: m}
m.BeginTxMock = mConnectorMockBeginTx{mock: m}
m.CloseMock = mConnectorMockClose{mock: m}
m.DriverMock = mConnectorMockDriver{mock: m}
m.ExecMock = mConnectorMockExec{mock: m}
m.ExecContextMock = mConnectorMockExecContext{mock: m}
m.PingMock = mConnectorMockPing{mock: m}
m.PingContextMock = mConnectorMockPingContext{mock: m}
m.PrepareMock = mConnectorMockPrepare{mock: m}
m.PrepareContextMock = mConnectorMockPrepareContext{mock: m}
m.QueryMock = mConnectorMockQuery{mock: m}
m.QueryContextMock = mConnectorMockQueryContext{mock: m}
m.QueryRowMock = mConnectorMockQueryRow{mock: m}
m.QueryRowContextMock = mConnectorMockQueryRowContext{mock: m}
m.SetConnMaxLifetimeMock = mConnectorMockSetConnMaxLifetime{mock: m}
m.SetMaxIdleConnsMock = mConnectorMockSetMaxIdleConns{mock: m}
m.SetMaxOpenConnsMock = mConnectorMockSetMaxOpenConns{mock: m}
m.StatsMock = mConnectorMockStats{mock: m}
return m
}
type mConnectorMockBegin struct {
mock *ConnectorMock
}
//Return sets up a mock for Connector.Begin to return Return's arguments
func (m *mConnectorMockBegin) Return(r *sql.Tx, r1 error) *ConnectorMock {
m.mock.BeginFunc = func() (*sql.Tx, error) {
return r, r1
}
return m.mock
}
//Set uses given function f as a mock of Connector.Begin method
func (m *mConnectorMockBegin) Set(f func() (r *sql.Tx, r1 error)) *ConnectorMock {
m.mock.BeginFunc = f
return m.mock
}
//Begin implements github.com/hexdigest/prep.Connector interface
func (m *ConnectorMock) Begin() (r *sql.Tx, r1 error) {
defer atomic.AddUint64(&m.BeginCounter, 1)
if m.BeginFunc == nil {
m.t.Fatal("Unexpected call to ConnectorMock.Begin")
return
}
return m.BeginFunc()
}
//BeginMinimockCounter returns a count of Connector.Begin invocations
func (m *ConnectorMock) BeginMinimockCounter() uint64 {
return atomic.LoadUint64(&m.BeginCounter)
}
type mConnectorMockBeginTx struct {
mock *ConnectorMock
mockExpectations *ConnectorMockBeginTxParams
}
//ConnectorMockBeginTxParams represents input parameters of the Connector.BeginTx
type ConnectorMockBeginTxParams struct {
p context.Context
p1 *sql.TxOptions
}
//Expect sets up expected params for the Connector.BeginTx
func (m *mConnectorMockBeginTx) Expect(p context.Context, p1 *sql.TxOptions) *mConnectorMockBeginTx {
m.mockExpectations = &ConnectorMockBeginTxParams{p, p1}
return m
}
//Return sets up a mock for Connector.BeginTx to return Return's arguments
func (m *mConnectorMockBeginTx) Return(r *sql.Tx, r1 error) *ConnectorMock {
m.mock.BeginTxFunc = func(p context.Context, p1 *sql.TxOptions) (*sql.Tx, error) {
return r, r1
}
return m.mock
}
//Set uses given function f as a mock of Connector.BeginTx method
func (m *mConnectorMockBeginTx) Set(f func(p context.Context, p1 *sql.TxOptions) (r *sql.Tx, r1 error)) *ConnectorMock {
m.mock.BeginTxFunc = f
return m.mock
}
//BeginTx implements github.com/hexdigest/prep.Connector interface
func (m *ConnectorMock) BeginTx(p context.Context, p1 *sql.TxOptions) (r *sql.Tx, r1 error) {
defer atomic.AddUint64(&m.BeginTxCounter, 1)
if m.BeginTxMock.mockExpectations != nil {
testify_assert.Equal(m.t, *m.BeginTxMock.mockExpectations, ConnectorMockBeginTxParams{p, p1},
"Connector.BeginTx got unexpected parameters")
if m.BeginTxFunc == nil {
m.t.Fatal("No results are set for the ConnectorMock.BeginTx")
return
}
}
if m.BeginTxFunc == nil {
m.t.Fatal("Unexpected call to ConnectorMock.BeginTx")
return
}
return m.BeginTxFunc(p, p1)
}
//BeginTxMinimockCounter returns a count of Connector.BeginTx invocations
func (m *ConnectorMock) BeginTxMinimockCounter() uint64 {
return atomic.LoadUint64(&m.BeginTxCounter)
}
type mConnectorMockClose struct {
mock *ConnectorMock
}
//Return sets up a mock for Connector.Close to return Return's arguments
func (m *mConnectorMockClose) Return(r error) *ConnectorMock {
m.mock.CloseFunc = func() error {
return r
}
return m.mock
}
//Set uses given function f as a mock of Connector.Close method
func (m *mConnectorMockClose) Set(f func() (r error)) *ConnectorMock {
m.mock.CloseFunc = f
return m.mock
}
//Close implements github.com/hexdigest/prep.Connector interface
func (m *ConnectorMock) Close() (r error) {
defer atomic.AddUint64(&m.CloseCounter, 1)
if m.CloseFunc == nil {
m.t.Fatal("Unexpected call to ConnectorMock.Close")
return
}
return m.CloseFunc()
}
//CloseMinimockCounter returns a count of Connector.Close invocations
func (m *ConnectorMock) CloseMinimockCounter() uint64 {
return atomic.LoadUint64(&m.CloseCounter)
}
type mConnectorMockDriver struct {
mock *ConnectorMock
}
//Return sets up a mock for Connector.Driver to return Return's arguments
func (m *mConnectorMockDriver) Return(r driver.Driver) *ConnectorMock {
m.mock.DriverFunc = func() driver.Driver {
return r
}
return m.mock
}
//Set uses given function f as a mock of Connector.Driver method
func (m *mConnectorMockDriver) Set(f func() (r driver.Driver)) *ConnectorMock {
m.mock.DriverFunc = f
return m.mock
}
//Driver implements github.com/hexdigest/prep.Connector interface
func (m *ConnectorMock) Driver() (r driver.Driver) {
defer atomic.AddUint64(&m.DriverCounter, 1)
if m.DriverFunc == nil {
m.t.Fatal("Unexpected call to ConnectorMock.Driver")
return
}
return m.DriverFunc()
}
//DriverMinimockCounter returns a count of Connector.Driver invocations
func (m *ConnectorMock) DriverMinimockCounter() uint64 {
return atomic.LoadUint64(&m.DriverCounter)
}
type mConnectorMockExec struct {
mock *ConnectorMock
mockExpectations *ConnectorMockExecParams
}
//ConnectorMockExecParams represents input parameters of the Connector.Exec
type ConnectorMockExecParams struct {
p string
p1 []interface{}
}
//Expect sets up expected params for the Connector.Exec
func (m *mConnectorMockExec) Expect(p string, p1 ...interface{}) *mConnectorMockExec {
m.mockExpectations = &ConnectorMockExecParams{p, p1}
return m
}
//Return sets up a mock for Connector.Exec to return Return's arguments
func (m *mConnectorMockExec) Return(r sql.Result, r1 error) *ConnectorMock {
m.mock.ExecFunc = func(p string, p1 ...interface{}) (sql.Result, error) {
return r, r1
}
return m.mock
}
//Set uses given function f as a mock of Connector.Exec method
func (m *mConnectorMockExec) Set(f func(p string, p1 ...interface{}) (r sql.Result, r1 error)) *ConnectorMock {
m.mock.ExecFunc = f
return m.mock
}
//Exec implements github.com/hexdigest/prep.Connector interface
func (m *ConnectorMock) Exec(p string, p1 ...interface{}) (r sql.Result, r1 error) {
defer atomic.AddUint64(&m.ExecCounter, 1)
if m.ExecMock.mockExpectations != nil {
testify_assert.Equal(m.t, *m.ExecMock.mockExpectations, ConnectorMockExecParams{p, p1},
"Connector.Exec got unexpected parameters")
if m.ExecFunc == nil {
m.t.Fatal("No results are set for the ConnectorMock.Exec")
return
}
}
if m.ExecFunc == nil {
m.t.Fatal("Unexpected call to ConnectorMock.Exec")
return
}
return m.ExecFunc(p, p1...)
}
//ExecMinimockCounter returns a count of Connector.Exec invocations
func (m *ConnectorMock) ExecMinimockCounter() uint64 {
return atomic.LoadUint64(&m.ExecCounter)
}
type mConnectorMockExecContext struct {
mock *ConnectorMock
mockExpectations *ConnectorMockExecContextParams
}
//ConnectorMockExecContextParams represents input parameters of the Connector.ExecContext
type ConnectorMockExecContextParams struct {
p context.Context
p1 string
p2 []interface{}
}
//Expect sets up expected params for the Connector.ExecContext
func (m *mConnectorMockExecContext) Expect(p context.Context, p1 string, p2 ...interface{}) *mConnectorMockExecContext {
m.mockExpectations = &ConnectorMockExecContextParams{p, p1, p2}
return m
}
//Return sets up a mock for Connector.ExecContext to return Return's arguments
func (m *mConnectorMockExecContext) Return(r sql.Result, r1 error) *ConnectorMock {
m.mock.ExecContextFunc = func(p context.Context, p1 string, p2 ...interface{}) (sql.Result, error) {
return r, r1
}
return m.mock
}
//Set uses given function f as a mock of Connector.ExecContext method
func (m *mConnectorMockExecContext) Set(f func(p context.Context, p1 string, p2 ...interface{}) (r sql.Result, r1 error)) *ConnectorMock {
m.mock.ExecContextFunc = f
return m.mock
}
//ExecContext implements github.com/hexdigest/prep.Connector interface
func (m *ConnectorMock) ExecContext(p context.Context, p1 string, p2 ...interface{}) (r sql.Result, r1 error) {
defer atomic.AddUint64(&m.ExecContextCounter, 1)
if m.ExecContextMock.mockExpectations != nil {
testify_assert.Equal(m.t, *m.ExecContextMock.mockExpectations, ConnectorMockExecContextParams{p, p1, p2},
"Connector.ExecContext got unexpected parameters")
if m.ExecContextFunc == nil {
m.t.Fatal("No results are set for the ConnectorMock.ExecContext")
return
}
}
if m.ExecContextFunc == nil {
m.t.Fatal("Unexpected call to ConnectorMock.ExecContext")
return
}
return m.ExecContextFunc(p, p1, p2...)
}
//ExecContextMinimockCounter returns a count of Connector.ExecContext invocations
func (m *ConnectorMock) ExecContextMinimockCounter() uint64 {
return atomic.LoadUint64(&m.ExecContextCounter)
}
type mConnectorMockPing struct {
mock *ConnectorMock
}
//Return sets up a mock for Connector.Ping to return Return's arguments
func (m *mConnectorMockPing) Return(r error) *ConnectorMock {
m.mock.PingFunc = func() error {
return r
}
return m.mock
}
//Set uses given function f as a mock of Connector.Ping method
func (m *mConnectorMockPing) Set(f func() (r error)) *ConnectorMock {
m.mock.PingFunc = f
return m.mock
}
//Ping implements github.com/hexdigest/prep.Connector interface
func (m *ConnectorMock) Ping() (r error) {
defer atomic.AddUint64(&m.PingCounter, 1)
if m.PingFunc == nil {
m.t.Fatal("Unexpected call to ConnectorMock.Ping")
return
}
return m.PingFunc()
}
//PingMinimockCounter returns a count of Connector.Ping invocations
func (m *ConnectorMock) PingMinimockCounter() uint64 {
return atomic.LoadUint64(&m.PingCounter)
}
type mConnectorMockPingContext struct {
mock *ConnectorMock
mockExpectations *ConnectorMockPingContextParams
}
//ConnectorMockPingContextParams represents input parameters of the Connector.PingContext
type ConnectorMockPingContextParams struct {
p context.Context
}
//Expect sets up expected params for the Connector.PingContext
func (m *mConnectorMockPingContext) Expect(p context.Context) *mConnectorMockPingContext {
m.mockExpectations = &ConnectorMockPingContextParams{p}
return m
}
//Return sets up a mock for Connector.PingContext to return Return's arguments
func (m *mConnectorMockPingContext) Return(r error) *ConnectorMock {
m.mock.PingContextFunc = func(p context.Context) error {
return r
}
return m.mock
}
//Set uses given function f as a mock of Connector.PingContext method
func (m *mConnectorMockPingContext) Set(f func(p context.Context) (r error)) *ConnectorMock {
m.mock.PingContextFunc = f
return m.mock
}
//PingContext implements github.com/hexdigest/prep.Connector interface
func (m *ConnectorMock) PingContext(p context.Context) (r error) {
defer atomic.AddUint64(&m.PingContextCounter, 1)
if m.PingContextMock.mockExpectations != nil {
testify_assert.Equal(m.t, *m.PingContextMock.mockExpectations, ConnectorMockPingContextParams{p},
"Connector.PingContext got unexpected parameters")
if m.PingContextFunc == nil {
m.t.Fatal("No results are set for the ConnectorMock.PingContext")
return
}
}
if m.PingContextFunc == nil {
m.t.Fatal("Unexpected call to ConnectorMock.PingContext")
return
}
return m.PingContextFunc(p)
}
//PingContextMinimockCounter returns a count of Connector.PingContext invocations
func (m *ConnectorMock) PingContextMinimockCounter() uint64 {
return atomic.LoadUint64(&m.PingContextCounter)
}
type mConnectorMockPrepare struct {
mock *ConnectorMock
mockExpectations *ConnectorMockPrepareParams
}
//ConnectorMockPrepareParams represents input parameters of the Connector.Prepare
type ConnectorMockPrepareParams struct {
p string
}
//Expect sets up expected params for the Connector.Prepare
func (m *mConnectorMockPrepare) Expect(p string) *mConnectorMockPrepare {
m.mockExpectations = &ConnectorMockPrepareParams{p}
return m
}
//Return sets up a mock for Connector.Prepare to return Return's arguments
func (m *mConnectorMockPrepare) Return(r *sql.Stmt, r1 error) *ConnectorMock {
m.mock.PrepareFunc = func(p string) (*sql.Stmt, error) {
return r, r1
}
return m.mock
}
//Set uses given function f as a mock of Connector.Prepare method
func (m *mConnectorMockPrepare) Set(f func(p string) (r *sql.Stmt, r1 error)) *ConnectorMock {
m.mock.PrepareFunc = f
return m.mock
}
//Prepare implements github.com/hexdigest/prep.Connector interface
func (m *ConnectorMock) Prepare(p string) (r *sql.Stmt, r1 error) {
defer atomic.AddUint64(&m.PrepareCounter, 1)
if m.PrepareMock.mockExpectations != nil {
testify_assert.Equal(m.t, *m.PrepareMock.mockExpectations, ConnectorMockPrepareParams{p},
"Connector.Prepare got unexpected parameters")
if m.PrepareFunc == nil {
m.t.Fatal("No results are set for the ConnectorMock.Prepare")
return
}
}
if m.PrepareFunc == nil {
m.t.Fatal("Unexpected call to ConnectorMock.Prepare")
return
}
return m.PrepareFunc(p)
}
//PrepareMinimockCounter returns a count of Connector.Prepare invocations
func (m *ConnectorMock) PrepareMinimockCounter() uint64 {
return atomic.LoadUint64(&m.PrepareCounter)
}
type mConnectorMockPrepareContext struct {
mock *ConnectorMock
mockExpectations *ConnectorMockPrepareContextParams
}
//ConnectorMockPrepareContextParams represents input parameters of the Connector.PrepareContext
type ConnectorMockPrepareContextParams struct {
p context.Context
p1 string
}
//Expect sets up expected params for the Connector.PrepareContext
func (m *mConnectorMockPrepareContext) Expect(p context.Context, p1 string) *mConnectorMockPrepareContext {
m.mockExpectations = &ConnectorMockPrepareContextParams{p, p1}
return m
}
//Return sets up a mock for Connector.PrepareContext to return Return's arguments
func (m *mConnectorMockPrepareContext) Return(r *sql.Stmt, r1 error) *ConnectorMock {
m.mock.PrepareContextFunc = func(p context.Context, p1 string) (*sql.Stmt, error) {
return r, r1
}
return m.mock
}
//Set uses given function f as a mock of Connector.PrepareContext method
func (m *mConnectorMockPrepareContext) Set(f func(p context.Context, p1 string) (r *sql.Stmt, r1 error)) *ConnectorMock {
m.mock.PrepareContextFunc = f
return m.mock
}
//PrepareContext implements github.com/hexdigest/prep.Connector interface
func (m *ConnectorMock) PrepareContext(p context.Context, p1 string) (r *sql.Stmt, r1 error) {
defer atomic.AddUint64(&m.PrepareContextCounter, 1)
if m.PrepareContextMock.mockExpectations != nil {
testify_assert.Equal(m.t, *m.PrepareContextMock.mockExpectations, ConnectorMockPrepareContextParams{p, p1},
"Connector.PrepareContext got unexpected parameters")
if m.PrepareContextFunc == nil {
m.t.Fatal("No results are set for the ConnectorMock.PrepareContext")
return
}
}
if m.PrepareContextFunc == nil {
m.t.Fatal("Unexpected call to ConnectorMock.PrepareContext")
return
}
return m.PrepareContextFunc(p, p1)
}
//PrepareContextMinimockCounter returns a count of Connector.PrepareContext invocations
func (m *ConnectorMock) PrepareContextMinimockCounter() uint64 {
return atomic.LoadUint64(&m.PrepareContextCounter)
}
type mConnectorMockQuery struct {
mock *ConnectorMock
mockExpectations *ConnectorMockQueryParams
}
//ConnectorMockQueryParams represents input parameters of the Connector.Query
type ConnectorMockQueryParams struct {
p string
p1 []interface{}
}
//Expect sets up expected params for the Connector.Query
func (m *mConnectorMockQuery) Expect(p string, p1 ...interface{}) *mConnectorMockQuery {
m.mockExpectations = &ConnectorMockQueryParams{p, p1}
return m
}
//Return sets up a mock for Connector.Query to return Return's arguments
func (m *mConnectorMockQuery) Return(r *sql.Rows, r1 error) *ConnectorMock {
m.mock.QueryFunc = func(p string, p1 ...interface{}) (*sql.Rows, error) {
return r, r1
}
return m.mock
}
//Set uses given function f as a mock of Connector.Query method
func (m *mConnectorMockQuery) Set(f func(p string, p1 ...interface{}) (r *sql.Rows, r1 error)) *ConnectorMock {
m.mock.QueryFunc = f
return m.mock
}
//Query implements github.com/hexdigest/prep.Connector interface
func (m *ConnectorMock) Query(p string, p1 ...interface{}) (r *sql.Rows, r1 error) {
defer atomic.AddUint64(&m.QueryCounter, 1)
if m.QueryMock.mockExpectations != nil {
testify_assert.Equal(m.t, *m.QueryMock.mockExpectations, ConnectorMockQueryParams{p, p1},
"Connector.Query got unexpected parameters")
if m.QueryFunc == nil {
m.t.Fatal("No results are set for the ConnectorMock.Query")
return
}
}
if m.QueryFunc == nil {
m.t.Fatal("Unexpected call to ConnectorMock.Query")
return
}
return m.QueryFunc(p, p1...)
}
//QueryMinimockCounter returns a count of Connector.Query invocations
func (m *ConnectorMock) QueryMinimockCounter() uint64 {
return atomic.LoadUint64(&m.QueryCounter)
}
type mConnectorMockQueryContext struct {
mock *ConnectorMock
mockExpectations *ConnectorMockQueryContextParams
}
//ConnectorMockQueryContextParams represents input parameters of the Connector.QueryContext
type ConnectorMockQueryContextParams struct {
p context.Context
p1 string
p2 []interface{}
}
//Expect sets up expected params for the Connector.QueryContext
func (m *mConnectorMockQueryContext) Expect(p context.Context, p1 string, p2 ...interface{}) *mConnectorMockQueryContext {
m.mockExpectations = &ConnectorMockQueryContextParams{p, p1, p2}
return m
}
//Return sets up a mock for Connector.QueryContext to return Return's arguments
func (m *mConnectorMockQueryContext) Return(r *sql.Rows, r1 error) *ConnectorMock {
m.mock.QueryContextFunc = func(p context.Context, p1 string, p2 ...interface{}) (*sql.Rows, error) {
return r, r1
}
return m.mock
}
//Set uses given function f as a mock of Connector.QueryContext method
func (m *mConnectorMockQueryContext) Set(f func(p context.Context, p1 string, p2 ...interface{}) (r *sql.Rows, r1 error)) *ConnectorMock {
m.mock.QueryContextFunc = f
return m.mock
}
//QueryContext implements github.com/hexdigest/prep.Connector interface
func (m *ConnectorMock) QueryContext(p context.Context, p1 string, p2 ...interface{}) (r *sql.Rows, r1 error) {
defer atomic.AddUint64(&m.QueryContextCounter, 1)
if m.QueryContextMock.mockExpectations != nil {
testify_assert.Equal(m.t, *m.QueryContextMock.mockExpectations, ConnectorMockQueryContextParams{p, p1, p2},
"Connector.QueryContext got unexpected parameters")
if m.QueryContextFunc == nil {
m.t.Fatal("No results are set for the ConnectorMock.QueryContext")
return
}
}
if m.QueryContextFunc == nil {
m.t.Fatal("Unexpected call to ConnectorMock.QueryContext")
return
}
return m.QueryContextFunc(p, p1, p2...)
}
//QueryContextMinimockCounter returns a count of Connector.QueryContext invocations
func (m *ConnectorMock) QueryContextMinimockCounter() uint64 {
return atomic.LoadUint64(&m.QueryContextCounter)
}
type mConnectorMockQueryRow struct {
mock *ConnectorMock
mockExpectations *ConnectorMockQueryRowParams
}
//ConnectorMockQueryRowParams represents input parameters of the Connector.QueryRow
type ConnectorMockQueryRowParams struct {
p string
p1 []interface{}
}
//Expect sets up expected params for the Connector.QueryRow
func (m *mConnectorMockQueryRow) Expect(p string, p1 ...interface{}) *mConnectorMockQueryRow {
m.mockExpectations = &ConnectorMockQueryRowParams{p, p1}
return m
}
//Return sets up a mock for Connector.QueryRow to return Return's arguments
func (m *mConnectorMockQueryRow) Return(r *sql.Row) *ConnectorMock {
m.mock.QueryRowFunc = func(p string, p1 ...interface{}) *sql.Row {
return r
}
return m.mock
}
//Set uses given function f as a mock of Connector.QueryRow method
func (m *mConnectorMockQueryRow) Set(f func(p string, p1 ...interface{}) (r *sql.Row)) *ConnectorMock {
m.mock.QueryRowFunc = f
return m.mock
}
//QueryRow implements github.com/hexdigest/prep.Connector interface
func (m *ConnectorMock) QueryRow(p string, p1 ...interface{}) (r *sql.Row) {
defer atomic.AddUint64(&m.QueryRowCounter, 1)
if m.QueryRowMock.mockExpectations != nil {
testify_assert.Equal(m.t, *m.QueryRowMock.mockExpectations, ConnectorMockQueryRowParams{p, p1},
"Connector.QueryRow got unexpected parameters")
if m.QueryRowFunc == nil {
m.t.Fatal("No results are set for the ConnectorMock.QueryRow")
return
}
}
if m.QueryRowFunc == nil {
m.t.Fatal("Unexpected call to ConnectorMock.QueryRow")
return
}
return m.QueryRowFunc(p, p1...)
}
//QueryRowMinimockCounter returns a count of Connector.QueryRow invocations
func (m *ConnectorMock) QueryRowMinimockCounter() uint64 {
return atomic.LoadUint64(&m.QueryRowCounter)
}
type mConnectorMockQueryRowContext struct {
mock *ConnectorMock
mockExpectations *ConnectorMockQueryRowContextParams
}
//ConnectorMockQueryRowContextParams represents input parameters of the Connector.QueryRowContext
type ConnectorMockQueryRowContextParams struct {
p context.Context
p1 string
p2 []interface{}
}
//Expect sets up expected params for the Connector.QueryRowContext
func (m *mConnectorMockQueryRowContext) Expect(p context.Context, p1 string, p2 ...interface{}) *mConnectorMockQueryRowContext {
m.mockExpectations = &ConnectorMockQueryRowContextParams{p, p1, p2}
return m
}
//Return sets up a mock for Connector.QueryRowContext to return Return's arguments
func (m *mConnectorMockQueryRowContext) Return(r *sql.Row) *ConnectorMock {
m.mock.QueryRowContextFunc = func(p context.Context, p1 string, p2 ...interface{}) *sql.Row {
return r
}
return m.mock
}
//Set uses given function f as a mock of Connector.QueryRowContext method
func (m *mConnectorMockQueryRowContext) Set(f func(p context.Context, p1 string, p2 ...interface{}) (r *sql.Row)) *ConnectorMock {
m.mock.QueryRowContextFunc = f
return m.mock
}
//QueryRowContext implements github.com/hexdigest/prep.Connector interface
func (m *ConnectorMock) QueryRowContext(p context.Context, p1 string, p2 ...interface{}) (r *sql.Row) {
defer atomic.AddUint64(&m.QueryRowContextCounter, 1)
if m.QueryRowContextMock.mockExpectations != nil {
testify_assert.Equal(m.t, *m.QueryRowContextMock.mockExpectations, ConnectorMockQueryRowContextParams{p, p1, p2},
"Connector.QueryRowContext got unexpected parameters")
if m.QueryRowContextFunc == nil {
m.t.Fatal("No results are set for the ConnectorMock.QueryRowContext")
return
}
}
if m.QueryRowContextFunc == nil {
m.t.Fatal("Unexpected call to ConnectorMock.QueryRowContext")
return
}
return m.QueryRowContextFunc(p, p1, p2...)
}
//QueryRowContextMinimockCounter returns a count of Connector.QueryRowContext invocations
func (m *ConnectorMock) QueryRowContextMinimockCounter() uint64 {
return atomic.LoadUint64(&m.QueryRowContextCounter)
}
type mConnectorMockSetConnMaxLifetime struct {
mock *ConnectorMock
mockExpectations *ConnectorMockSetConnMaxLifetimeParams
}
//ConnectorMockSetConnMaxLifetimeParams represents input parameters of the Connector.SetConnMaxLifetime
type ConnectorMockSetConnMaxLifetimeParams struct {
p time.Duration
}
//Expect sets up expected params for the Connector.SetConnMaxLifetime
func (m *mConnectorMockSetConnMaxLifetime) Expect(p time.Duration) *mConnectorMockSetConnMaxLifetime {
m.mockExpectations = &ConnectorMockSetConnMaxLifetimeParams{p}
return m
}
//Return sets up a mock for Connector.SetConnMaxLifetime to return Return's arguments
func (m *mConnectorMockSetConnMaxLifetime) Return() *ConnectorMock {
m.mock.SetConnMaxLifetimeFunc = func(p time.Duration) {
return
}
return m.mock
}
//Set uses given function f as a mock of Connector.SetConnMaxLifetime method
func (m *mConnectorMockSetConnMaxLifetime) Set(f func(p time.Duration)) *ConnectorMock {
m.mock.SetConnMaxLifetimeFunc = f
return m.mock
}
//SetConnMaxLifetime implements github.com/hexdigest/prep.Connector interface
func (m *ConnectorMock) SetConnMaxLifetime(p time.Duration) {
defer atomic.AddUint64(&m.SetConnMaxLifetimeCounter, 1)
if m.SetConnMaxLifetimeMock.mockExpectations != nil {
testify_assert.Equal(m.t, *m.SetConnMaxLifetimeMock.mockExpectations, ConnectorMockSetConnMaxLifetimeParams{p},
"Connector.SetConnMaxLifetime got unexpected parameters")
if m.SetConnMaxLifetimeFunc == nil {
m.t.Fatal("No results are set for the ConnectorMock.SetConnMaxLifetime")
return
}
}
if m.SetConnMaxLifetimeFunc == nil {
m.t.Fatal("Unexpected call to ConnectorMock.SetConnMaxLifetime")
return
}
m.SetConnMaxLifetimeFunc(p)
}
//SetConnMaxLifetimeMinimockCounter returns a count of Connector.SetConnMaxLifetime invocations
func (m *ConnectorMock) SetConnMaxLifetimeMinimockCounter() uint64 {
return atomic.LoadUint64(&m.SetConnMaxLifetimeCounter)
}
type mConnectorMockSetMaxIdleConns struct {
mock *ConnectorMock
mockExpectations *ConnectorMockSetMaxIdleConnsParams
}
//ConnectorMockSetMaxIdleConnsParams represents input parameters of the Connector.SetMaxIdleConns
type ConnectorMockSetMaxIdleConnsParams struct {
p int
}
//Expect sets up expected params for the Connector.SetMaxIdleConns
func (m *mConnectorMockSetMaxIdleConns) Expect(p int) *mConnectorMockSetMaxIdleConns {
m.mockExpectations = &ConnectorMockSetMaxIdleConnsParams{p}
return m
}
//Return sets up a mock for Connector.SetMaxIdleConns to return Return's arguments
func (m *mConnectorMockSetMaxIdleConns) Return() *ConnectorMock {
m.mock.SetMaxIdleConnsFunc = func(p int) {
return
}
return m.mock
}
//Set uses given function f as a mock of Connector.SetMaxIdleConns method
func (m *mConnectorMockSetMaxIdleConns) Set(f func(p int)) *ConnectorMock {
m.mock.SetMaxIdleConnsFunc = f
return m.mock
}
//SetMaxIdleConns implements github.com/hexdigest/prep.Connector interface
func (m *ConnectorMock) SetMaxIdleConns(p int) {
defer atomic.AddUint64(&m.SetMaxIdleConnsCounter, 1)
if m.SetMaxIdleConnsMock.mockExpectations != nil {
testify_assert.Equal(m.t, *m.SetMaxIdleConnsMock.mockExpectations, ConnectorMockSetMaxIdleConnsParams{p},
"Connector.SetMaxIdleConns got unexpected parameters")
if m.SetMaxIdleConnsFunc == nil {
m.t.Fatal("No results are set for the ConnectorMock.SetMaxIdleConns")
return
}
}
if m.SetMaxIdleConnsFunc == nil {
m.t.Fatal("Unexpected call to ConnectorMock.SetMaxIdleConns")
return
}
m.SetMaxIdleConnsFunc(p)
}
//SetMaxIdleConnsMinimockCounter returns a count of Connector.SetMaxIdleConns invocations
func (m *ConnectorMock) SetMaxIdleConnsMinimockCounter() uint64 {
return atomic.LoadUint64(&m.SetMaxIdleConnsCounter)
}
type mConnectorMockSetMaxOpenConns struct {
mock *ConnectorMock
mockExpectations *ConnectorMockSetMaxOpenConnsParams
}
//ConnectorMockSetMaxOpenConnsParams represents input parameters of the Connector.SetMaxOpenConns
type ConnectorMockSetMaxOpenConnsParams struct {
p int
}
//Expect sets up expected params for the Connector.SetMaxOpenConns
func (m *mConnectorMockSetMaxOpenConns) Expect(p int) *mConnectorMockSetMaxOpenConns {
m.mockExpectations = &ConnectorMockSetMaxOpenConnsParams{p}
return m
}