-
Notifications
You must be signed in to change notification settings - Fork 62
/
Copy pathPrivateMessageRepo.go
492 lines (405 loc) · 16.8 KB
/
PrivateMessageRepo.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
// Code generated by mockery v2.43.0. DO NOT EDIT.
package mocks
import (
context "context"
pm "github.com/bangumi/server/internal/pm"
mock "github.com/stretchr/testify/mock"
)
// PrivateMessageRepo is an autogenerated mock type for the Repo type
type PrivateMessageRepo struct {
mock.Mock
}
type PrivateMessageRepo_Expecter struct {
mock *mock.Mock
}
func (_m *PrivateMessageRepo) EXPECT() *PrivateMessageRepo_Expecter {
return &PrivateMessageRepo_Expecter{mock: &_m.Mock}
}
// CountByFolder provides a mock function with given fields: ctx, userID, folder
func (_m *PrivateMessageRepo) CountByFolder(ctx context.Context, userID uint32, folder pm.FolderType) (int64, error) {
ret := _m.Called(ctx, userID, folder)
if len(ret) == 0 {
panic("no return value specified for CountByFolder")
}
var r0 int64
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, uint32, pm.FolderType) (int64, error)); ok {
return rf(ctx, userID, folder)
}
if rf, ok := ret.Get(0).(func(context.Context, uint32, pm.FolderType) int64); ok {
r0 = rf(ctx, userID, folder)
} else {
r0 = ret.Get(0).(int64)
}
if rf, ok := ret.Get(1).(func(context.Context, uint32, pm.FolderType) error); ok {
r1 = rf(ctx, userID, folder)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// PrivateMessageRepo_CountByFolder_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CountByFolder'
type PrivateMessageRepo_CountByFolder_Call struct {
*mock.Call
}
// CountByFolder is a helper method to define mock.On call
// - ctx context.Context
// - userID uint32
// - folder pm.FolderType
func (_e *PrivateMessageRepo_Expecter) CountByFolder(ctx interface{}, userID interface{}, folder interface{}) *PrivateMessageRepo_CountByFolder_Call {
return &PrivateMessageRepo_CountByFolder_Call{Call: _e.mock.On("CountByFolder", ctx, userID, folder)}
}
func (_c *PrivateMessageRepo_CountByFolder_Call) Run(run func(ctx context.Context, userID uint32, folder pm.FolderType)) *PrivateMessageRepo_CountByFolder_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(uint32), args[2].(pm.FolderType))
})
return _c
}
func (_c *PrivateMessageRepo_CountByFolder_Call) Return(_a0 int64, _a1 error) *PrivateMessageRepo_CountByFolder_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *PrivateMessageRepo_CountByFolder_Call) RunAndReturn(run func(context.Context, uint32, pm.FolderType) (int64, error)) *PrivateMessageRepo_CountByFolder_Call {
_c.Call.Return(run)
return _c
}
// CountTypes provides a mock function with given fields: ctx, userID
func (_m *PrivateMessageRepo) CountTypes(ctx context.Context, userID uint32) (pm.PrivateMessageTypeCounts, error) {
ret := _m.Called(ctx, userID)
if len(ret) == 0 {
panic("no return value specified for CountTypes")
}
var r0 pm.PrivateMessageTypeCounts
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, uint32) (pm.PrivateMessageTypeCounts, error)); ok {
return rf(ctx, userID)
}
if rf, ok := ret.Get(0).(func(context.Context, uint32) pm.PrivateMessageTypeCounts); ok {
r0 = rf(ctx, userID)
} else {
r0 = ret.Get(0).(pm.PrivateMessageTypeCounts)
}
if rf, ok := ret.Get(1).(func(context.Context, uint32) error); ok {
r1 = rf(ctx, userID)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// PrivateMessageRepo_CountTypes_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CountTypes'
type PrivateMessageRepo_CountTypes_Call struct {
*mock.Call
}
// CountTypes is a helper method to define mock.On call
// - ctx context.Context
// - userID uint32
func (_e *PrivateMessageRepo_Expecter) CountTypes(ctx interface{}, userID interface{}) *PrivateMessageRepo_CountTypes_Call {
return &PrivateMessageRepo_CountTypes_Call{Call: _e.mock.On("CountTypes", ctx, userID)}
}
func (_c *PrivateMessageRepo_CountTypes_Call) Run(run func(ctx context.Context, userID uint32)) *PrivateMessageRepo_CountTypes_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(uint32))
})
return _c
}
func (_c *PrivateMessageRepo_CountTypes_Call) Return(_a0 pm.PrivateMessageTypeCounts, _a1 error) *PrivateMessageRepo_CountTypes_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *PrivateMessageRepo_CountTypes_Call) RunAndReturn(run func(context.Context, uint32) (pm.PrivateMessageTypeCounts, error)) *PrivateMessageRepo_CountTypes_Call {
_c.Call.Return(run)
return _c
}
// Create provides a mock function with given fields: ctx, senderID, receiverIDs, relatedIDFilter, title, content
func (_m *PrivateMessageRepo) Create(ctx context.Context, senderID uint32, receiverIDs []uint32, relatedIDFilter pm.IDFilter, title string, content string) ([]pm.PrivateMessage, error) {
ret := _m.Called(ctx, senderID, receiverIDs, relatedIDFilter, title, content)
if len(ret) == 0 {
panic("no return value specified for Create")
}
var r0 []pm.PrivateMessage
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, uint32, []uint32, pm.IDFilter, string, string) ([]pm.PrivateMessage, error)); ok {
return rf(ctx, senderID, receiverIDs, relatedIDFilter, title, content)
}
if rf, ok := ret.Get(0).(func(context.Context, uint32, []uint32, pm.IDFilter, string, string) []pm.PrivateMessage); ok {
r0 = rf(ctx, senderID, receiverIDs, relatedIDFilter, title, content)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]pm.PrivateMessage)
}
}
if rf, ok := ret.Get(1).(func(context.Context, uint32, []uint32, pm.IDFilter, string, string) error); ok {
r1 = rf(ctx, senderID, receiverIDs, relatedIDFilter, title, content)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// PrivateMessageRepo_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create'
type PrivateMessageRepo_Create_Call struct {
*mock.Call
}
// Create is a helper method to define mock.On call
// - ctx context.Context
// - senderID uint32
// - receiverIDs []uint32
// - relatedIDFilter pm.IDFilter
// - title string
// - content string
func (_e *PrivateMessageRepo_Expecter) Create(ctx interface{}, senderID interface{}, receiverIDs interface{}, relatedIDFilter interface{}, title interface{}, content interface{}) *PrivateMessageRepo_Create_Call {
return &PrivateMessageRepo_Create_Call{Call: _e.mock.On("Create", ctx, senderID, receiverIDs, relatedIDFilter, title, content)}
}
func (_c *PrivateMessageRepo_Create_Call) Run(run func(ctx context.Context, senderID uint32, receiverIDs []uint32, relatedIDFilter pm.IDFilter, title string, content string)) *PrivateMessageRepo_Create_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(uint32), args[2].([]uint32), args[3].(pm.IDFilter), args[4].(string), args[5].(string))
})
return _c
}
func (_c *PrivateMessageRepo_Create_Call) Return(_a0 []pm.PrivateMessage, _a1 error) *PrivateMessageRepo_Create_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *PrivateMessageRepo_Create_Call) RunAndReturn(run func(context.Context, uint32, []uint32, pm.IDFilter, string, string) ([]pm.PrivateMessage, error)) *PrivateMessageRepo_Create_Call {
_c.Call.Return(run)
return _c
}
// Delete provides a mock function with given fields: ctx, userID, ids
func (_m *PrivateMessageRepo) Delete(ctx context.Context, userID uint32, ids []uint32) error {
ret := _m.Called(ctx, userID, ids)
if len(ret) == 0 {
panic("no return value specified for Delete")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, uint32, []uint32) error); ok {
r0 = rf(ctx, userID, ids)
} else {
r0 = ret.Error(0)
}
return r0
}
// PrivateMessageRepo_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete'
type PrivateMessageRepo_Delete_Call struct {
*mock.Call
}
// Delete is a helper method to define mock.On call
// - ctx context.Context
// - userID uint32
// - ids []uint32
func (_e *PrivateMessageRepo_Expecter) Delete(ctx interface{}, userID interface{}, ids interface{}) *PrivateMessageRepo_Delete_Call {
return &PrivateMessageRepo_Delete_Call{Call: _e.mock.On("Delete", ctx, userID, ids)}
}
func (_c *PrivateMessageRepo_Delete_Call) Run(run func(ctx context.Context, userID uint32, ids []uint32)) *PrivateMessageRepo_Delete_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(uint32), args[2].([]uint32))
})
return _c
}
func (_c *PrivateMessageRepo_Delete_Call) Return(_a0 error) *PrivateMessageRepo_Delete_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *PrivateMessageRepo_Delete_Call) RunAndReturn(run func(context.Context, uint32, []uint32) error) *PrivateMessageRepo_Delete_Call {
_c.Call.Return(run)
return _c
}
// List provides a mock function with given fields: ctx, userID, folder, offset, limit
func (_m *PrivateMessageRepo) List(ctx context.Context, userID uint32, folder pm.FolderType, offset int, limit int) ([]pm.PrivateMessageListItem, error) {
ret := _m.Called(ctx, userID, folder, offset, limit)
if len(ret) == 0 {
panic("no return value specified for List")
}
var r0 []pm.PrivateMessageListItem
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, uint32, pm.FolderType, int, int) ([]pm.PrivateMessageListItem, error)); ok {
return rf(ctx, userID, folder, offset, limit)
}
if rf, ok := ret.Get(0).(func(context.Context, uint32, pm.FolderType, int, int) []pm.PrivateMessageListItem); ok {
r0 = rf(ctx, userID, folder, offset, limit)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]pm.PrivateMessageListItem)
}
}
if rf, ok := ret.Get(1).(func(context.Context, uint32, pm.FolderType, int, int) error); ok {
r1 = rf(ctx, userID, folder, offset, limit)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// PrivateMessageRepo_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List'
type PrivateMessageRepo_List_Call struct {
*mock.Call
}
// List is a helper method to define mock.On call
// - ctx context.Context
// - userID uint32
// - folder pm.FolderType
// - offset int
// - limit int
func (_e *PrivateMessageRepo_Expecter) List(ctx interface{}, userID interface{}, folder interface{}, offset interface{}, limit interface{}) *PrivateMessageRepo_List_Call {
return &PrivateMessageRepo_List_Call{Call: _e.mock.On("List", ctx, userID, folder, offset, limit)}
}
func (_c *PrivateMessageRepo_List_Call) Run(run func(ctx context.Context, userID uint32, folder pm.FolderType, offset int, limit int)) *PrivateMessageRepo_List_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(uint32), args[2].(pm.FolderType), args[3].(int), args[4].(int))
})
return _c
}
func (_c *PrivateMessageRepo_List_Call) Return(_a0 []pm.PrivateMessageListItem, _a1 error) *PrivateMessageRepo_List_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *PrivateMessageRepo_List_Call) RunAndReturn(run func(context.Context, uint32, pm.FolderType, int, int) ([]pm.PrivateMessageListItem, error)) *PrivateMessageRepo_List_Call {
_c.Call.Return(run)
return _c
}
// ListRecentContact provides a mock function with given fields: ctx, userID
func (_m *PrivateMessageRepo) ListRecentContact(ctx context.Context, userID uint32) ([]uint32, error) {
ret := _m.Called(ctx, userID)
if len(ret) == 0 {
panic("no return value specified for ListRecentContact")
}
var r0 []uint32
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, uint32) ([]uint32, error)); ok {
return rf(ctx, userID)
}
if rf, ok := ret.Get(0).(func(context.Context, uint32) []uint32); ok {
r0 = rf(ctx, userID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]uint32)
}
}
if rf, ok := ret.Get(1).(func(context.Context, uint32) error); ok {
r1 = rf(ctx, userID)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// PrivateMessageRepo_ListRecentContact_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListRecentContact'
type PrivateMessageRepo_ListRecentContact_Call struct {
*mock.Call
}
// ListRecentContact is a helper method to define mock.On call
// - ctx context.Context
// - userID uint32
func (_e *PrivateMessageRepo_Expecter) ListRecentContact(ctx interface{}, userID interface{}) *PrivateMessageRepo_ListRecentContact_Call {
return &PrivateMessageRepo_ListRecentContact_Call{Call: _e.mock.On("ListRecentContact", ctx, userID)}
}
func (_c *PrivateMessageRepo_ListRecentContact_Call) Run(run func(ctx context.Context, userID uint32)) *PrivateMessageRepo_ListRecentContact_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(uint32))
})
return _c
}
func (_c *PrivateMessageRepo_ListRecentContact_Call) Return(_a0 []uint32, _a1 error) *PrivateMessageRepo_ListRecentContact_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *PrivateMessageRepo_ListRecentContact_Call) RunAndReturn(run func(context.Context, uint32) ([]uint32, error)) *PrivateMessageRepo_ListRecentContact_Call {
_c.Call.Return(run)
return _c
}
// ListRelated provides a mock function with given fields: ctx, userID, id
func (_m *PrivateMessageRepo) ListRelated(ctx context.Context, userID uint32, id uint32) ([]pm.PrivateMessage, error) {
ret := _m.Called(ctx, userID, id)
if len(ret) == 0 {
panic("no return value specified for ListRelated")
}
var r0 []pm.PrivateMessage
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, uint32, uint32) ([]pm.PrivateMessage, error)); ok {
return rf(ctx, userID, id)
}
if rf, ok := ret.Get(0).(func(context.Context, uint32, uint32) []pm.PrivateMessage); ok {
r0 = rf(ctx, userID, id)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]pm.PrivateMessage)
}
}
if rf, ok := ret.Get(1).(func(context.Context, uint32, uint32) error); ok {
r1 = rf(ctx, userID, id)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// PrivateMessageRepo_ListRelated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListRelated'
type PrivateMessageRepo_ListRelated_Call struct {
*mock.Call
}
// ListRelated is a helper method to define mock.On call
// - ctx context.Context
// - userID uint32
// - id uint32
func (_e *PrivateMessageRepo_Expecter) ListRelated(ctx interface{}, userID interface{}, id interface{}) *PrivateMessageRepo_ListRelated_Call {
return &PrivateMessageRepo_ListRelated_Call{Call: _e.mock.On("ListRelated", ctx, userID, id)}
}
func (_c *PrivateMessageRepo_ListRelated_Call) Run(run func(ctx context.Context, userID uint32, id uint32)) *PrivateMessageRepo_ListRelated_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(uint32), args[2].(uint32))
})
return _c
}
func (_c *PrivateMessageRepo_ListRelated_Call) Return(_a0 []pm.PrivateMessage, _a1 error) *PrivateMessageRepo_ListRelated_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *PrivateMessageRepo_ListRelated_Call) RunAndReturn(run func(context.Context, uint32, uint32) ([]pm.PrivateMessage, error)) *PrivateMessageRepo_ListRelated_Call {
_c.Call.Return(run)
return _c
}
// MarkRead provides a mock function with given fields: ctx, userID, relatedID
func (_m *PrivateMessageRepo) MarkRead(ctx context.Context, userID uint32, relatedID uint32) error {
ret := _m.Called(ctx, userID, relatedID)
if len(ret) == 0 {
panic("no return value specified for MarkRead")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, uint32, uint32) error); ok {
r0 = rf(ctx, userID, relatedID)
} else {
r0 = ret.Error(0)
}
return r0
}
// PrivateMessageRepo_MarkRead_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'MarkRead'
type PrivateMessageRepo_MarkRead_Call struct {
*mock.Call
}
// MarkRead is a helper method to define mock.On call
// - ctx context.Context
// - userID uint32
// - relatedID uint32
func (_e *PrivateMessageRepo_Expecter) MarkRead(ctx interface{}, userID interface{}, relatedID interface{}) *PrivateMessageRepo_MarkRead_Call {
return &PrivateMessageRepo_MarkRead_Call{Call: _e.mock.On("MarkRead", ctx, userID, relatedID)}
}
func (_c *PrivateMessageRepo_MarkRead_Call) Run(run func(ctx context.Context, userID uint32, relatedID uint32)) *PrivateMessageRepo_MarkRead_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(uint32), args[2].(uint32))
})
return _c
}
func (_c *PrivateMessageRepo_MarkRead_Call) Return(_a0 error) *PrivateMessageRepo_MarkRead_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *PrivateMessageRepo_MarkRead_Call) RunAndReturn(run func(context.Context, uint32, uint32) error) *PrivateMessageRepo_MarkRead_Call {
_c.Call.Return(run)
return _c
}
// NewPrivateMessageRepo creates a new instance of PrivateMessageRepo. 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 NewPrivateMessageRepo(t interface {
mock.TestingT
Cleanup(func())
}) *PrivateMessageRepo {
mock := &PrivateMessageRepo{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}