generated from sv-tools/go-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 2
/
cursor.go
552 lines (442 loc) · 13.4 KB
/
cursor.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
// Code generated by mockery. DO NOT EDIT.
package mocks
import (
context "context"
bson "go.mongodb.org/mongo-driver/bson"
mock "github.com/stretchr/testify/mock"
time "time"
)
// Cursor is an autogenerated mock type for the Cursor type
type Cursor struct {
mock.Mock
}
type Cursor_Expecter struct {
mock *mock.Mock
}
func (_m *Cursor) EXPECT() *Cursor_Expecter {
return &Cursor_Expecter{mock: &_m.Mock}
}
// All provides a mock function with given fields: ctx, results
func (_m *Cursor) All(ctx context.Context, results interface{}) error {
ret := _m.Called(ctx, results)
if len(ret) == 0 {
panic("no return value specified for All")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, interface{}) error); ok {
r0 = rf(ctx, results)
} else {
r0 = ret.Error(0)
}
return r0
}
// Cursor_All_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'All'
type Cursor_All_Call struct {
*mock.Call
}
// All is a helper method to define mock.On call
// - ctx context.Context
// - results interface{}
func (_e *Cursor_Expecter) All(ctx interface{}, results interface{}) *Cursor_All_Call {
return &Cursor_All_Call{Call: _e.mock.On("All", ctx, results)}
}
func (_c *Cursor_All_Call) Run(run func(ctx context.Context, results interface{})) *Cursor_All_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(interface{}))
})
return _c
}
func (_c *Cursor_All_Call) Return(_a0 error) *Cursor_All_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Cursor_All_Call) RunAndReturn(run func(context.Context, interface{}) error) *Cursor_All_Call {
_c.Call.Return(run)
return _c
}
// Close provides a mock function with given fields: ctx
func (_m *Cursor) Close(ctx context.Context) error {
ret := _m.Called(ctx)
if len(ret) == 0 {
panic("no return value specified for Close")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context) error); ok {
r0 = rf(ctx)
} else {
r0 = ret.Error(0)
}
return r0
}
// Cursor_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close'
type Cursor_Close_Call struct {
*mock.Call
}
// Close is a helper method to define mock.On call
// - ctx context.Context
func (_e *Cursor_Expecter) Close(ctx interface{}) *Cursor_Close_Call {
return &Cursor_Close_Call{Call: _e.mock.On("Close", ctx)}
}
func (_c *Cursor_Close_Call) Run(run func(ctx context.Context)) *Cursor_Close_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context))
})
return _c
}
func (_c *Cursor_Close_Call) Return(_a0 error) *Cursor_Close_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Cursor_Close_Call) RunAndReturn(run func(context.Context) error) *Cursor_Close_Call {
_c.Call.Return(run)
return _c
}
// Current provides a mock function with given fields:
func (_m *Cursor) Current() bson.Raw {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Current")
}
var r0 bson.Raw
if rf, ok := ret.Get(0).(func() bson.Raw); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(bson.Raw)
}
}
return r0
}
// Cursor_Current_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Current'
type Cursor_Current_Call struct {
*mock.Call
}
// Current is a helper method to define mock.On call
func (_e *Cursor_Expecter) Current() *Cursor_Current_Call {
return &Cursor_Current_Call{Call: _e.mock.On("Current")}
}
func (_c *Cursor_Current_Call) Run(run func()) *Cursor_Current_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *Cursor_Current_Call) Return(_a0 bson.Raw) *Cursor_Current_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Cursor_Current_Call) RunAndReturn(run func() bson.Raw) *Cursor_Current_Call {
_c.Call.Return(run)
return _c
}
// Decode provides a mock function with given fields: val
func (_m *Cursor) Decode(val interface{}) error {
ret := _m.Called(val)
if len(ret) == 0 {
panic("no return value specified for Decode")
}
var r0 error
if rf, ok := ret.Get(0).(func(interface{}) error); ok {
r0 = rf(val)
} else {
r0 = ret.Error(0)
}
return r0
}
// Cursor_Decode_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Decode'
type Cursor_Decode_Call struct {
*mock.Call
}
// Decode is a helper method to define mock.On call
// - val interface{}
func (_e *Cursor_Expecter) Decode(val interface{}) *Cursor_Decode_Call {
return &Cursor_Decode_Call{Call: _e.mock.On("Decode", val)}
}
func (_c *Cursor_Decode_Call) Run(run func(val interface{})) *Cursor_Decode_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(interface{}))
})
return _c
}
func (_c *Cursor_Decode_Call) Return(_a0 error) *Cursor_Decode_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Cursor_Decode_Call) RunAndReturn(run func(interface{}) error) *Cursor_Decode_Call {
_c.Call.Return(run)
return _c
}
// Err provides a mock function with given fields:
func (_m *Cursor) Err() error {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Err")
}
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// Cursor_Err_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Err'
type Cursor_Err_Call struct {
*mock.Call
}
// Err is a helper method to define mock.On call
func (_e *Cursor_Expecter) Err() *Cursor_Err_Call {
return &Cursor_Err_Call{Call: _e.mock.On("Err")}
}
func (_c *Cursor_Err_Call) Run(run func()) *Cursor_Err_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *Cursor_Err_Call) Return(_a0 error) *Cursor_Err_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Cursor_Err_Call) RunAndReturn(run func() error) *Cursor_Err_Call {
_c.Call.Return(run)
return _c
}
// ID provides a mock function with given fields:
func (_m *Cursor) ID() int64 {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for ID")
}
var r0 int64
if rf, ok := ret.Get(0).(func() int64); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(int64)
}
return r0
}
// Cursor_ID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ID'
type Cursor_ID_Call struct {
*mock.Call
}
// ID is a helper method to define mock.On call
func (_e *Cursor_Expecter) ID() *Cursor_ID_Call {
return &Cursor_ID_Call{Call: _e.mock.On("ID")}
}
func (_c *Cursor_ID_Call) Run(run func()) *Cursor_ID_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *Cursor_ID_Call) Return(_a0 int64) *Cursor_ID_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Cursor_ID_Call) RunAndReturn(run func() int64) *Cursor_ID_Call {
_c.Call.Return(run)
return _c
}
// Next provides a mock function with given fields: ctx
func (_m *Cursor) Next(ctx context.Context) bool {
ret := _m.Called(ctx)
if len(ret) == 0 {
panic("no return value specified for Next")
}
var r0 bool
if rf, ok := ret.Get(0).(func(context.Context) bool); ok {
r0 = rf(ctx)
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// Cursor_Next_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Next'
type Cursor_Next_Call struct {
*mock.Call
}
// Next is a helper method to define mock.On call
// - ctx context.Context
func (_e *Cursor_Expecter) Next(ctx interface{}) *Cursor_Next_Call {
return &Cursor_Next_Call{Call: _e.mock.On("Next", ctx)}
}
func (_c *Cursor_Next_Call) Run(run func(ctx context.Context)) *Cursor_Next_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context))
})
return _c
}
func (_c *Cursor_Next_Call) Return(_a0 bool) *Cursor_Next_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Cursor_Next_Call) RunAndReturn(run func(context.Context) bool) *Cursor_Next_Call {
_c.Call.Return(run)
return _c
}
// RemainingBatchLength provides a mock function with given fields:
func (_m *Cursor) RemainingBatchLength() int {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for RemainingBatchLength")
}
var r0 int
if rf, ok := ret.Get(0).(func() int); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(int)
}
return r0
}
// Cursor_RemainingBatchLength_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemainingBatchLength'
type Cursor_RemainingBatchLength_Call struct {
*mock.Call
}
// RemainingBatchLength is a helper method to define mock.On call
func (_e *Cursor_Expecter) RemainingBatchLength() *Cursor_RemainingBatchLength_Call {
return &Cursor_RemainingBatchLength_Call{Call: _e.mock.On("RemainingBatchLength")}
}
func (_c *Cursor_RemainingBatchLength_Call) Run(run func()) *Cursor_RemainingBatchLength_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *Cursor_RemainingBatchLength_Call) Return(_a0 int) *Cursor_RemainingBatchLength_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Cursor_RemainingBatchLength_Call) RunAndReturn(run func() int) *Cursor_RemainingBatchLength_Call {
_c.Call.Return(run)
return _c
}
// SetBatchSize provides a mock function with given fields: batchSize
func (_m *Cursor) SetBatchSize(batchSize int32) {
_m.Called(batchSize)
}
// Cursor_SetBatchSize_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetBatchSize'
type Cursor_SetBatchSize_Call struct {
*mock.Call
}
// SetBatchSize is a helper method to define mock.On call
// - batchSize int32
func (_e *Cursor_Expecter) SetBatchSize(batchSize interface{}) *Cursor_SetBatchSize_Call {
return &Cursor_SetBatchSize_Call{Call: _e.mock.On("SetBatchSize", batchSize)}
}
func (_c *Cursor_SetBatchSize_Call) Run(run func(batchSize int32)) *Cursor_SetBatchSize_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(int32))
})
return _c
}
func (_c *Cursor_SetBatchSize_Call) Return() *Cursor_SetBatchSize_Call {
_c.Call.Return()
return _c
}
func (_c *Cursor_SetBatchSize_Call) RunAndReturn(run func(int32)) *Cursor_SetBatchSize_Call {
_c.Call.Return(run)
return _c
}
// SetComment provides a mock function with given fields: comment
func (_m *Cursor) SetComment(comment interface{}) {
_m.Called(comment)
}
// Cursor_SetComment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetComment'
type Cursor_SetComment_Call struct {
*mock.Call
}
// SetComment is a helper method to define mock.On call
// - comment interface{}
func (_e *Cursor_Expecter) SetComment(comment interface{}) *Cursor_SetComment_Call {
return &Cursor_SetComment_Call{Call: _e.mock.On("SetComment", comment)}
}
func (_c *Cursor_SetComment_Call) Run(run func(comment interface{})) *Cursor_SetComment_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(interface{}))
})
return _c
}
func (_c *Cursor_SetComment_Call) Return() *Cursor_SetComment_Call {
_c.Call.Return()
return _c
}
func (_c *Cursor_SetComment_Call) RunAndReturn(run func(interface{})) *Cursor_SetComment_Call {
_c.Call.Return(run)
return _c
}
// SetMaxTime provides a mock function with given fields: dur
func (_m *Cursor) SetMaxTime(dur time.Duration) {
_m.Called(dur)
}
// Cursor_SetMaxTime_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetMaxTime'
type Cursor_SetMaxTime_Call struct {
*mock.Call
}
// SetMaxTime is a helper method to define mock.On call
// - dur time.Duration
func (_e *Cursor_Expecter) SetMaxTime(dur interface{}) *Cursor_SetMaxTime_Call {
return &Cursor_SetMaxTime_Call{Call: _e.mock.On("SetMaxTime", dur)}
}
func (_c *Cursor_SetMaxTime_Call) Run(run func(dur time.Duration)) *Cursor_SetMaxTime_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(time.Duration))
})
return _c
}
func (_c *Cursor_SetMaxTime_Call) Return() *Cursor_SetMaxTime_Call {
_c.Call.Return()
return _c
}
func (_c *Cursor_SetMaxTime_Call) RunAndReturn(run func(time.Duration)) *Cursor_SetMaxTime_Call {
_c.Call.Return(run)
return _c
}
// TryNext provides a mock function with given fields: ctx
func (_m *Cursor) TryNext(ctx context.Context) bool {
ret := _m.Called(ctx)
if len(ret) == 0 {
panic("no return value specified for TryNext")
}
var r0 bool
if rf, ok := ret.Get(0).(func(context.Context) bool); ok {
r0 = rf(ctx)
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// Cursor_TryNext_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TryNext'
type Cursor_TryNext_Call struct {
*mock.Call
}
// TryNext is a helper method to define mock.On call
// - ctx context.Context
func (_e *Cursor_Expecter) TryNext(ctx interface{}) *Cursor_TryNext_Call {
return &Cursor_TryNext_Call{Call: _e.mock.On("TryNext", ctx)}
}
func (_c *Cursor_TryNext_Call) Run(run func(ctx context.Context)) *Cursor_TryNext_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context))
})
return _c
}
func (_c *Cursor_TryNext_Call) Return(_a0 bool) *Cursor_TryNext_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Cursor_TryNext_Call) RunAndReturn(run func(context.Context) bool) *Cursor_TryNext_Call {
_c.Call.Return(run)
return _c
}
// NewCursor creates a new instance of Cursor. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewCursor(t interface {
mock.TestingT
Cleanup(func())
}) *Cursor {
mock := &Cursor{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}