-
Notifications
You must be signed in to change notification settings - Fork 61
/
CollectionRepo.go
369 lines (302 loc) · 15.4 KB
/
CollectionRepo.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
// Code generated by mockery v2.14.0. DO NOT EDIT.
package mocks
import (
context "context"
domain "github.com/bangumi/server/internal/domain"
mock "github.com/stretchr/testify/mock"
model "github.com/bangumi/server/internal/model"
query "github.com/bangumi/server/internal/dal/query"
time "time"
)
// CollectionRepo is an autogenerated mock type for the CollectionRepo type
type CollectionRepo struct {
mock.Mock
}
type CollectionRepo_Expecter struct {
mock *mock.Mock
}
func (_m *CollectionRepo) EXPECT() *CollectionRepo_Expecter {
return &CollectionRepo_Expecter{mock: &_m.Mock}
}
// CountSubjectCollections provides a mock function with given fields: ctx, userID, subjectType, collectionType, showPrivate
func (_m *CollectionRepo) CountSubjectCollections(ctx context.Context, userID model.UserID, subjectType uint8, collectionType model.SubjectCollection, showPrivate bool) (int64, error) {
ret := _m.Called(ctx, userID, subjectType, collectionType, showPrivate)
var r0 int64
if rf, ok := ret.Get(0).(func(context.Context, model.UserID, uint8, model.SubjectCollection, bool) int64); ok {
r0 = rf(ctx, userID, subjectType, collectionType, showPrivate)
} else {
r0 = ret.Get(0).(int64)
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, model.UserID, uint8, model.SubjectCollection, bool) error); ok {
r1 = rf(ctx, userID, subjectType, collectionType, showPrivate)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// CollectionRepo_CountSubjectCollections_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CountSubjectCollections'
type CollectionRepo_CountSubjectCollections_Call struct {
*mock.Call
}
// CountSubjectCollections is a helper method to define mock.On call
// - ctx context.Context
// - userID model.UserID
// - subjectType uint8
// - collectionType model.SubjectCollection
// - showPrivate bool
func (_e *CollectionRepo_Expecter) CountSubjectCollections(ctx interface{}, userID interface{}, subjectType interface{}, collectionType interface{}, showPrivate interface{}) *CollectionRepo_CountSubjectCollections_Call {
return &CollectionRepo_CountSubjectCollections_Call{Call: _e.mock.On("CountSubjectCollections", ctx, userID, subjectType, collectionType, showPrivate)}
}
func (_c *CollectionRepo_CountSubjectCollections_Call) Run(run func(ctx context.Context, userID model.UserID, subjectType uint8, collectionType model.SubjectCollection, showPrivate bool)) *CollectionRepo_CountSubjectCollections_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(model.UserID), args[2].(uint8), args[3].(model.SubjectCollection), args[4].(bool))
})
return _c
}
func (_c *CollectionRepo_CountSubjectCollections_Call) Return(_a0 int64, _a1 error) *CollectionRepo_CountSubjectCollections_Call {
_c.Call.Return(_a0, _a1)
return _c
}
// GetSubjectCollection provides a mock function with given fields: ctx, userID, subjectID
func (_m *CollectionRepo) GetSubjectCollection(ctx context.Context, userID model.UserID, subjectID model.SubjectID) (model.UserSubjectCollection, error) {
ret := _m.Called(ctx, userID, subjectID)
var r0 model.UserSubjectCollection
if rf, ok := ret.Get(0).(func(context.Context, model.UserID, model.SubjectID) model.UserSubjectCollection); ok {
r0 = rf(ctx, userID, subjectID)
} else {
r0 = ret.Get(0).(model.UserSubjectCollection)
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, model.UserID, model.SubjectID) error); ok {
r1 = rf(ctx, userID, subjectID)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// CollectionRepo_GetSubjectCollection_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSubjectCollection'
type CollectionRepo_GetSubjectCollection_Call struct {
*mock.Call
}
// GetSubjectCollection is a helper method to define mock.On call
// - ctx context.Context
// - userID model.UserID
// - subjectID model.SubjectID
func (_e *CollectionRepo_Expecter) GetSubjectCollection(ctx interface{}, userID interface{}, subjectID interface{}) *CollectionRepo_GetSubjectCollection_Call {
return &CollectionRepo_GetSubjectCollection_Call{Call: _e.mock.On("GetSubjectCollection", ctx, userID, subjectID)}
}
func (_c *CollectionRepo_GetSubjectCollection_Call) Run(run func(ctx context.Context, userID model.UserID, subjectID model.SubjectID)) *CollectionRepo_GetSubjectCollection_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(model.UserID), args[2].(model.SubjectID))
})
return _c
}
func (_c *CollectionRepo_GetSubjectCollection_Call) Return(_a0 model.UserSubjectCollection, _a1 error) *CollectionRepo_GetSubjectCollection_Call {
_c.Call.Return(_a0, _a1)
return _c
}
// GetSubjectEpisodesCollection provides a mock function with given fields: ctx, userID, subjectID
func (_m *CollectionRepo) GetSubjectEpisodesCollection(ctx context.Context, userID model.UserID, subjectID model.SubjectID) (model.UserSubjectEpisodesCollection, error) {
ret := _m.Called(ctx, userID, subjectID)
var r0 model.UserSubjectEpisodesCollection
if rf, ok := ret.Get(0).(func(context.Context, model.UserID, model.SubjectID) model.UserSubjectEpisodesCollection); ok {
r0 = rf(ctx, userID, subjectID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(model.UserSubjectEpisodesCollection)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, model.UserID, model.SubjectID) error); ok {
r1 = rf(ctx, userID, subjectID)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// CollectionRepo_GetSubjectEpisodesCollection_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSubjectEpisodesCollection'
type CollectionRepo_GetSubjectEpisodesCollection_Call struct {
*mock.Call
}
// GetSubjectEpisodesCollection is a helper method to define mock.On call
// - ctx context.Context
// - userID model.UserID
// - subjectID model.SubjectID
func (_e *CollectionRepo_Expecter) GetSubjectEpisodesCollection(ctx interface{}, userID interface{}, subjectID interface{}) *CollectionRepo_GetSubjectEpisodesCollection_Call {
return &CollectionRepo_GetSubjectEpisodesCollection_Call{Call: _e.mock.On("GetSubjectEpisodesCollection", ctx, userID, subjectID)}
}
func (_c *CollectionRepo_GetSubjectEpisodesCollection_Call) Run(run func(ctx context.Context, userID model.UserID, subjectID model.SubjectID)) *CollectionRepo_GetSubjectEpisodesCollection_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(model.UserID), args[2].(model.SubjectID))
})
return _c
}
func (_c *CollectionRepo_GetSubjectEpisodesCollection_Call) Return(_a0 model.UserSubjectEpisodesCollection, _a1 error) *CollectionRepo_GetSubjectEpisodesCollection_Call {
_c.Call.Return(_a0, _a1)
return _c
}
// ListSubjectCollection provides a mock function with given fields: ctx, userID, subjectType, collectionType, showPrivate, limit, offset
func (_m *CollectionRepo) ListSubjectCollection(ctx context.Context, userID model.UserID, subjectType uint8, collectionType model.SubjectCollection, showPrivate bool, limit int, offset int) ([]model.UserSubjectCollection, error) {
ret := _m.Called(ctx, userID, subjectType, collectionType, showPrivate, limit, offset)
var r0 []model.UserSubjectCollection
if rf, ok := ret.Get(0).(func(context.Context, model.UserID, uint8, model.SubjectCollection, bool, int, int) []model.UserSubjectCollection); ok {
r0 = rf(ctx, userID, subjectType, collectionType, showPrivate, limit, offset)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]model.UserSubjectCollection)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, model.UserID, uint8, model.SubjectCollection, bool, int, int) error); ok {
r1 = rf(ctx, userID, subjectType, collectionType, showPrivate, limit, offset)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// CollectionRepo_ListSubjectCollection_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListSubjectCollection'
type CollectionRepo_ListSubjectCollection_Call struct {
*mock.Call
}
// ListSubjectCollection is a helper method to define mock.On call
// - ctx context.Context
// - userID model.UserID
// - subjectType uint8
// - collectionType model.SubjectCollection
// - showPrivate bool
// - limit int
// - offset int
func (_e *CollectionRepo_Expecter) ListSubjectCollection(ctx interface{}, userID interface{}, subjectType interface{}, collectionType interface{}, showPrivate interface{}, limit interface{}, offset interface{}) *CollectionRepo_ListSubjectCollection_Call {
return &CollectionRepo_ListSubjectCollection_Call{Call: _e.mock.On("ListSubjectCollection", ctx, userID, subjectType, collectionType, showPrivate, limit, offset)}
}
func (_c *CollectionRepo_ListSubjectCollection_Call) Run(run func(ctx context.Context, userID model.UserID, subjectType uint8, collectionType model.SubjectCollection, showPrivate bool, limit int, offset int)) *CollectionRepo_ListSubjectCollection_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(model.UserID), args[2].(uint8), args[3].(model.SubjectCollection), args[4].(bool), args[5].(int), args[6].(int))
})
return _c
}
func (_c *CollectionRepo_ListSubjectCollection_Call) Return(_a0 []model.UserSubjectCollection, _a1 error) *CollectionRepo_ListSubjectCollection_Call {
_c.Call.Return(_a0, _a1)
return _c
}
// UpdateEpisodeCollection provides a mock function with given fields: ctx, userID, subjectID, episodeIDs, collection, at
func (_m *CollectionRepo) UpdateEpisodeCollection(ctx context.Context, userID model.UserID, subjectID model.SubjectID, episodeIDs []model.EpisodeID, collection model.EpisodeCollection, at time.Time) (model.UserSubjectEpisodesCollection, error) {
ret := _m.Called(ctx, userID, subjectID, episodeIDs, collection, at)
var r0 model.UserSubjectEpisodesCollection
if rf, ok := ret.Get(0).(func(context.Context, model.UserID, model.SubjectID, []model.EpisodeID, model.EpisodeCollection, time.Time) model.UserSubjectEpisodesCollection); ok {
r0 = rf(ctx, userID, subjectID, episodeIDs, collection, at)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(model.UserSubjectEpisodesCollection)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, model.UserID, model.SubjectID, []model.EpisodeID, model.EpisodeCollection, time.Time) error); ok {
r1 = rf(ctx, userID, subjectID, episodeIDs, collection, at)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// CollectionRepo_UpdateEpisodeCollection_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateEpisodeCollection'
type CollectionRepo_UpdateEpisodeCollection_Call struct {
*mock.Call
}
// UpdateEpisodeCollection is a helper method to define mock.On call
// - ctx context.Context
// - userID model.UserID
// - subjectID model.SubjectID
// - episodeIDs []model.EpisodeID
// - collection model.EpisodeCollection
// - at time.Time
func (_e *CollectionRepo_Expecter) UpdateEpisodeCollection(ctx interface{}, userID interface{}, subjectID interface{}, episodeIDs interface{}, collection interface{}, at interface{}) *CollectionRepo_UpdateEpisodeCollection_Call {
return &CollectionRepo_UpdateEpisodeCollection_Call{Call: _e.mock.On("UpdateEpisodeCollection", ctx, userID, subjectID, episodeIDs, collection, at)}
}
func (_c *CollectionRepo_UpdateEpisodeCollection_Call) Run(run func(ctx context.Context, userID model.UserID, subjectID model.SubjectID, episodeIDs []model.EpisodeID, collection model.EpisodeCollection, at time.Time)) *CollectionRepo_UpdateEpisodeCollection_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(model.UserID), args[2].(model.SubjectID), args[3].([]model.EpisodeID), args[4].(model.EpisodeCollection), args[5].(time.Time))
})
return _c
}
func (_c *CollectionRepo_UpdateEpisodeCollection_Call) Return(_a0 model.UserSubjectEpisodesCollection, _a1 error) *CollectionRepo_UpdateEpisodeCollection_Call {
_c.Call.Return(_a0, _a1)
return _c
}
// UpdateSubjectCollection provides a mock function with given fields: ctx, userID, subjectID, data, at
func (_m *CollectionRepo) UpdateSubjectCollection(ctx context.Context, userID model.UserID, subjectID model.SubjectID, data domain.SubjectCollectionUpdate, at time.Time) error {
ret := _m.Called(ctx, userID, subjectID, data, at)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, model.UserID, model.SubjectID, domain.SubjectCollectionUpdate, time.Time) error); ok {
r0 = rf(ctx, userID, subjectID, data, at)
} else {
r0 = ret.Error(0)
}
return r0
}
// CollectionRepo_UpdateSubjectCollection_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateSubjectCollection'
type CollectionRepo_UpdateSubjectCollection_Call struct {
*mock.Call
}
// UpdateSubjectCollection is a helper method to define mock.On call
// - ctx context.Context
// - userID model.UserID
// - subjectID model.SubjectID
// - data domain.SubjectCollectionUpdate
// - at time.Time
func (_e *CollectionRepo_Expecter) UpdateSubjectCollection(ctx interface{}, userID interface{}, subjectID interface{}, data interface{}, at interface{}) *CollectionRepo_UpdateSubjectCollection_Call {
return &CollectionRepo_UpdateSubjectCollection_Call{Call: _e.mock.On("UpdateSubjectCollection", ctx, userID, subjectID, data, at)}
}
func (_c *CollectionRepo_UpdateSubjectCollection_Call) Run(run func(ctx context.Context, userID model.UserID, subjectID model.SubjectID, data domain.SubjectCollectionUpdate, at time.Time)) *CollectionRepo_UpdateSubjectCollection_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(model.UserID), args[2].(model.SubjectID), args[3].(domain.SubjectCollectionUpdate), args[4].(time.Time))
})
return _c
}
func (_c *CollectionRepo_UpdateSubjectCollection_Call) Return(_a0 error) *CollectionRepo_UpdateSubjectCollection_Call {
_c.Call.Return(_a0)
return _c
}
// WithQuery provides a mock function with given fields: _a0
func (_m *CollectionRepo) WithQuery(_a0 *query.Query) domain.CollectionRepo {
ret := _m.Called(_a0)
var r0 domain.CollectionRepo
if rf, ok := ret.Get(0).(func(*query.Query) domain.CollectionRepo); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(domain.CollectionRepo)
}
}
return r0
}
// CollectionRepo_WithQuery_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WithQuery'
type CollectionRepo_WithQuery_Call struct {
*mock.Call
}
// WithQuery is a helper method to define mock.On call
// - _a0 *query.Query
func (_e *CollectionRepo_Expecter) WithQuery(_a0 interface{}) *CollectionRepo_WithQuery_Call {
return &CollectionRepo_WithQuery_Call{Call: _e.mock.On("WithQuery", _a0)}
}
func (_c *CollectionRepo_WithQuery_Call) Run(run func(_a0 *query.Query)) *CollectionRepo_WithQuery_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*query.Query))
})
return _c
}
func (_c *CollectionRepo_WithQuery_Call) Return(_a0 domain.CollectionRepo) *CollectionRepo_WithQuery_Call {
_c.Call.Return(_a0)
return _c
}
type mockConstructorTestingTNewCollectionRepo interface {
mock.TestingT
Cleanup(func())
}
// NewCollectionRepo creates a new instance of CollectionRepo. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewCollectionRepo(t mockConstructorTestingTNewCollectionRepo) *CollectionRepo {
mock := &CollectionRepo{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}