/
mongo_mock.go
469 lines (402 loc) · 14.1 KB
/
mongo_mock.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
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/juju/juju/mongo (interfaces: Collection,Query)
//
// Generated by this command:
//
// mockgen -package mocks -destination mocks/mongo_mock.go github.com/juju/juju/mongo Collection,Query
//
// Package mocks is a generated GoMock package.
package mocks
import (
reflect "reflect"
time "time"
mongo "github.com/juju/juju/mongo"
mgo "github.com/juju/mgo/v3"
gomock "go.uber.org/mock/gomock"
)
// MockCollection is a mock of Collection interface.
type MockCollection struct {
ctrl *gomock.Controller
recorder *MockCollectionMockRecorder
}
// MockCollectionMockRecorder is the mock recorder for MockCollection.
type MockCollectionMockRecorder struct {
mock *MockCollection
}
// NewMockCollection creates a new mock instance.
func NewMockCollection(ctrl *gomock.Controller) *MockCollection {
mock := &MockCollection{ctrl: ctrl}
mock.recorder = &MockCollectionMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockCollection) EXPECT() *MockCollectionMockRecorder {
return m.recorder
}
// Count mocks base method.
func (m *MockCollection) Count() (int, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Count")
ret0, _ := ret[0].(int)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Count indicates an expected call of Count.
func (mr *MockCollectionMockRecorder) Count() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Count", reflect.TypeOf((*MockCollection)(nil).Count))
}
// Find mocks base method.
func (m *MockCollection) Find(arg0 any) mongo.Query {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Find", arg0)
ret0, _ := ret[0].(mongo.Query)
return ret0
}
// Find indicates an expected call of Find.
func (mr *MockCollectionMockRecorder) Find(arg0 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Find", reflect.TypeOf((*MockCollection)(nil).Find), arg0)
}
// FindId mocks base method.
func (m *MockCollection) FindId(arg0 any) mongo.Query {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "FindId", arg0)
ret0, _ := ret[0].(mongo.Query)
return ret0
}
// FindId indicates an expected call of FindId.
func (mr *MockCollectionMockRecorder) FindId(arg0 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindId", reflect.TypeOf((*MockCollection)(nil).FindId), arg0)
}
// Name mocks base method.
func (m *MockCollection) Name() string {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Name")
ret0, _ := ret[0].(string)
return ret0
}
// Name indicates an expected call of Name.
func (mr *MockCollectionMockRecorder) Name() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Name", reflect.TypeOf((*MockCollection)(nil).Name))
}
// Pipe mocks base method.
func (m *MockCollection) Pipe(arg0 any) *mgo.Pipe {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Pipe", arg0)
ret0, _ := ret[0].(*mgo.Pipe)
return ret0
}
// Pipe indicates an expected call of Pipe.
func (mr *MockCollectionMockRecorder) Pipe(arg0 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Pipe", reflect.TypeOf((*MockCollection)(nil).Pipe), arg0)
}
// Writeable mocks base method.
func (m *MockCollection) Writeable() mongo.WriteCollection {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Writeable")
ret0, _ := ret[0].(mongo.WriteCollection)
return ret0
}
// Writeable indicates an expected call of Writeable.
func (mr *MockCollectionMockRecorder) Writeable() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Writeable", reflect.TypeOf((*MockCollection)(nil).Writeable))
}
// MockQuery is a mock of Query interface.
type MockQuery struct {
ctrl *gomock.Controller
recorder *MockQueryMockRecorder
}
// MockQueryMockRecorder is the mock recorder for MockQuery.
type MockQueryMockRecorder struct {
mock *MockQuery
}
// NewMockQuery creates a new mock instance.
func NewMockQuery(ctrl *gomock.Controller) *MockQuery {
mock := &MockQuery{ctrl: ctrl}
mock.recorder = &MockQueryMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockQuery) EXPECT() *MockQueryMockRecorder {
return m.recorder
}
// All mocks base method.
func (m *MockQuery) All(arg0 any) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "All", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// All indicates an expected call of All.
func (mr *MockQueryMockRecorder) All(arg0 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "All", reflect.TypeOf((*MockQuery)(nil).All), arg0)
}
// Apply mocks base method.
func (m *MockQuery) Apply(arg0 mgo.Change, arg1 any) (*mgo.ChangeInfo, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Apply", arg0, arg1)
ret0, _ := ret[0].(*mgo.ChangeInfo)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Apply indicates an expected call of Apply.
func (mr *MockQueryMockRecorder) Apply(arg0, arg1 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Apply", reflect.TypeOf((*MockQuery)(nil).Apply), arg0, arg1)
}
// Batch mocks base method.
func (m *MockQuery) Batch(arg0 int) mongo.Query {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Batch", arg0)
ret0, _ := ret[0].(mongo.Query)
return ret0
}
// Batch indicates an expected call of Batch.
func (mr *MockQueryMockRecorder) Batch(arg0 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Batch", reflect.TypeOf((*MockQuery)(nil).Batch), arg0)
}
// Comment mocks base method.
func (m *MockQuery) Comment(arg0 string) mongo.Query {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Comment", arg0)
ret0, _ := ret[0].(mongo.Query)
return ret0
}
// Comment indicates an expected call of Comment.
func (mr *MockQueryMockRecorder) Comment(arg0 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Comment", reflect.TypeOf((*MockQuery)(nil).Comment), arg0)
}
// Count mocks base method.
func (m *MockQuery) Count() (int, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Count")
ret0, _ := ret[0].(int)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Count indicates an expected call of Count.
func (mr *MockQueryMockRecorder) Count() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Count", reflect.TypeOf((*MockQuery)(nil).Count))
}
// Distinct mocks base method.
func (m *MockQuery) Distinct(arg0 string, arg1 any) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Distinct", arg0, arg1)
ret0, _ := ret[0].(error)
return ret0
}
// Distinct indicates an expected call of Distinct.
func (mr *MockQueryMockRecorder) Distinct(arg0, arg1 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Distinct", reflect.TypeOf((*MockQuery)(nil).Distinct), arg0, arg1)
}
// Explain mocks base method.
func (m *MockQuery) Explain(arg0 any) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Explain", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// Explain indicates an expected call of Explain.
func (mr *MockQueryMockRecorder) Explain(arg0 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Explain", reflect.TypeOf((*MockQuery)(nil).Explain), arg0)
}
// For mocks base method.
func (m *MockQuery) For(arg0 any, arg1 func() error) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "For", arg0, arg1)
ret0, _ := ret[0].(error)
return ret0
}
// For indicates an expected call of For.
func (mr *MockQueryMockRecorder) For(arg0, arg1 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "For", reflect.TypeOf((*MockQuery)(nil).For), arg0, arg1)
}
// Hint mocks base method.
func (m *MockQuery) Hint(arg0 ...string) mongo.Query {
m.ctrl.T.Helper()
varargs := []any{}
for _, a := range arg0 {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "Hint", varargs...)
ret0, _ := ret[0].(mongo.Query)
return ret0
}
// Hint indicates an expected call of Hint.
func (mr *MockQueryMockRecorder) Hint(arg0 ...any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Hint", reflect.TypeOf((*MockQuery)(nil).Hint), arg0...)
}
// Iter mocks base method.
func (m *MockQuery) Iter() mongo.Iterator {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Iter")
ret0, _ := ret[0].(mongo.Iterator)
return ret0
}
// Iter indicates an expected call of Iter.
func (mr *MockQueryMockRecorder) Iter() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Iter", reflect.TypeOf((*MockQuery)(nil).Iter))
}
// Limit mocks base method.
func (m *MockQuery) Limit(arg0 int) mongo.Query {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Limit", arg0)
ret0, _ := ret[0].(mongo.Query)
return ret0
}
// Limit indicates an expected call of Limit.
func (mr *MockQueryMockRecorder) Limit(arg0 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Limit", reflect.TypeOf((*MockQuery)(nil).Limit), arg0)
}
// LogReplay mocks base method.
func (m *MockQuery) LogReplay() mongo.Query {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "LogReplay")
ret0, _ := ret[0].(mongo.Query)
return ret0
}
// LogReplay indicates an expected call of LogReplay.
func (mr *MockQueryMockRecorder) LogReplay() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogReplay", reflect.TypeOf((*MockQuery)(nil).LogReplay))
}
// MapReduce mocks base method.
func (m *MockQuery) MapReduce(arg0 *mgo.MapReduce, arg1 any) (*mgo.MapReduceInfo, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "MapReduce", arg0, arg1)
ret0, _ := ret[0].(*mgo.MapReduceInfo)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// MapReduce indicates an expected call of MapReduce.
func (mr *MockQueryMockRecorder) MapReduce(arg0, arg1 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MapReduce", reflect.TypeOf((*MockQuery)(nil).MapReduce), arg0, arg1)
}
// One mocks base method.
func (m *MockQuery) One(arg0 any) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "One", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// One indicates an expected call of One.
func (mr *MockQueryMockRecorder) One(arg0 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "One", reflect.TypeOf((*MockQuery)(nil).One), arg0)
}
// Prefetch mocks base method.
func (m *MockQuery) Prefetch(arg0 float64) mongo.Query {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Prefetch", arg0)
ret0, _ := ret[0].(mongo.Query)
return ret0
}
// Prefetch indicates an expected call of Prefetch.
func (mr *MockQueryMockRecorder) Prefetch(arg0 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Prefetch", reflect.TypeOf((*MockQuery)(nil).Prefetch), arg0)
}
// Select mocks base method.
func (m *MockQuery) Select(arg0 any) mongo.Query {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Select", arg0)
ret0, _ := ret[0].(mongo.Query)
return ret0
}
// Select indicates an expected call of Select.
func (mr *MockQueryMockRecorder) Select(arg0 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Select", reflect.TypeOf((*MockQuery)(nil).Select), arg0)
}
// SetMaxScan mocks base method.
func (m *MockQuery) SetMaxScan(arg0 int) mongo.Query {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "SetMaxScan", arg0)
ret0, _ := ret[0].(mongo.Query)
return ret0
}
// SetMaxScan indicates an expected call of SetMaxScan.
func (mr *MockQueryMockRecorder) SetMaxScan(arg0 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetMaxScan", reflect.TypeOf((*MockQuery)(nil).SetMaxScan), arg0)
}
// SetMaxTime mocks base method.
func (m *MockQuery) SetMaxTime(arg0 time.Duration) mongo.Query {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "SetMaxTime", arg0)
ret0, _ := ret[0].(mongo.Query)
return ret0
}
// SetMaxTime indicates an expected call of SetMaxTime.
func (mr *MockQueryMockRecorder) SetMaxTime(arg0 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetMaxTime", reflect.TypeOf((*MockQuery)(nil).SetMaxTime), arg0)
}
// Skip mocks base method.
func (m *MockQuery) Skip(arg0 int) mongo.Query {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Skip", arg0)
ret0, _ := ret[0].(mongo.Query)
return ret0
}
// Skip indicates an expected call of Skip.
func (mr *MockQueryMockRecorder) Skip(arg0 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Skip", reflect.TypeOf((*MockQuery)(nil).Skip), arg0)
}
// Snapshot mocks base method.
func (m *MockQuery) Snapshot() mongo.Query {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Snapshot")
ret0, _ := ret[0].(mongo.Query)
return ret0
}
// Snapshot indicates an expected call of Snapshot.
func (mr *MockQueryMockRecorder) Snapshot() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Snapshot", reflect.TypeOf((*MockQuery)(nil).Snapshot))
}
// Sort mocks base method.
func (m *MockQuery) Sort(arg0 ...string) mongo.Query {
m.ctrl.T.Helper()
varargs := []any{}
for _, a := range arg0 {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "Sort", varargs...)
ret0, _ := ret[0].(mongo.Query)
return ret0
}
// Sort indicates an expected call of Sort.
func (mr *MockQueryMockRecorder) Sort(arg0 ...any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Sort", reflect.TypeOf((*MockQuery)(nil).Sort), arg0...)
}
// Tail mocks base method.
func (m *MockQuery) Tail(arg0 time.Duration) *mgo.Iter {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Tail", arg0)
ret0, _ := ret[0].(*mgo.Iter)
return ret0
}
// Tail indicates an expected call of Tail.
func (mr *MockQueryMockRecorder) Tail(arg0 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Tail", reflect.TypeOf((*MockQuery)(nil).Tail), arg0)
}