db.go
35589 bytes
1// Code generated by moq; DO NOT EDIT.
2// github.com/matryer/moq
3
4package db_mock
5
6import (
7 "context"
8 "github.com/TheEdgeOfRage/ytrssil-api/db"
9 "github.com/TheEdgeOfRage/ytrssil-api/models"
10 "sync"
11 "time"
12)
13
14// Ensure, that DBMock does implement db.DB.
15// If this is not the case, regenerate this file with moq.
16var _ db.DB = &DBMock{}
17
18// DBMock is a mock implementation of db.DB.
19//
20// func TestSomethingThatUsesDB(t *testing.T) {
21//
22// // make and configure a mocked db.DB
23// mockedDB := &DBMock{
24// AddVideoFunc: func(ctx context.Context, video models.Video, channelID string, isDiscarded bool) error {
25// panic("mock out the AddVideo method")
26// },
27// CloseFunc: func() {
28// panic("mock out the Close method")
29// },
30// DeleteVideoFileFunc: func(ctx context.Context, videoID string) error {
31// panic("mock out the DeleteVideoFile method")
32// },
33// DiscardVideoFunc: func(ctx context.Context, videoID string) error {
34// panic("mock out the DiscardVideo method")
35// },
36// GetChannelByIDFunc: func(ctx context.Context, channelID string) (*models.Channel, error) {
37// panic("mock out the GetChannelByID method")
38// },
39// GetLiveVideosFunc: func(ctx context.Context) ([]models.Video, error) {
40// panic("mock out the GetLiveVideos method")
41// },
42// GetNewVideosFunc: func(ctx context.Context, sortDesc bool) ([]models.Video, error) {
43// panic("mock out the GetNewVideos method")
44// },
45// GetVideoFunc: func(ctx context.Context, videoID string) (*models.Video, error) {
46// panic("mock out the GetVideo method")
47// },
48// GetVideosForCleanupFunc: func(ctx context.Context, olderThan time.Duration) ([]models.Video, error) {
49// panic("mock out the GetVideosForCleanup method")
50// },
51// GetWatchedVideosFunc: func(ctx context.Context, sortDesc bool, limit int, offset int) ([]models.Video, error) {
52// panic("mock out the GetWatchedVideos method")
53// },
54// HasVideoFunc: func(ctx context.Context, videoID string) (bool, error) {
55// panic("mock out the HasVideo method")
56// },
57// ListChannelsFunc: func(ctx context.Context) ([]models.Channel, error) {
58// panic("mock out the ListChannels method")
59// },
60// SetVideoDownloadCompletedFunc: func(ctx context.Context, videoID string, filePath string) error {
61// panic("mock out the SetVideoDownloadCompleted method")
62// },
63// SetVideoDownloadFailedFunc: func(ctx context.Context, videoID string, errorMsg string) error {
64// panic("mock out the SetVideoDownloadFailed method")
65// },
66// SetVideoDownloadStatusFunc: func(ctx context.Context, videoID string, status string) error {
67// panic("mock out the SetVideoDownloadStatus method")
68// },
69// SetVideoProgressFunc: func(ctx context.Context, videoID string, progress int) (*models.Video, error) {
70// panic("mock out the SetVideoProgress method")
71// },
72// SetVideoWatchTimeFunc: func(ctx context.Context, videoID string, watchTime *time.Time) error {
73// panic("mock out the SetVideoWatchTime method")
74// },
75// SubscribeToChannelFunc: func(ctx context.Context, channel models.Channel) error {
76// panic("mock out the SubscribeToChannel method")
77// },
78// ToggleChannelShortsFunc: func(ctx context.Context, channelID string, enableShorts bool) error {
79// panic("mock out the ToggleChannelShorts method")
80// },
81// UnsubscribeFromChannelFunc: func(ctx context.Context, channelID string) error {
82// panic("mock out the UnsubscribeFromChannel method")
83// },
84// UpdateVideoLiveStatusFunc: func(ctx context.Context, videoID string, isLive bool, duration int) error {
85// panic("mock out the UpdateVideoLiveStatus method")
86// },
87// }
88//
89// // use mockedDB in code that requires db.DB
90// // and then make assertions.
91//
92// }
93type DBMock struct {
94 // AddVideoFunc mocks the AddVideo method.
95 AddVideoFunc func(ctx context.Context, video models.Video, channelID string, isDiscarded bool) error
96
97 // CloseFunc mocks the Close method.
98 CloseFunc func()
99
100 // DeleteVideoFileFunc mocks the DeleteVideoFile method.
101 DeleteVideoFileFunc func(ctx context.Context, videoID string) error
102
103 // DiscardVideoFunc mocks the DiscardVideo method.
104 DiscardVideoFunc func(ctx context.Context, videoID string) error
105
106 // GetChannelByIDFunc mocks the GetChannelByID method.
107 GetChannelByIDFunc func(ctx context.Context, channelID string) (*models.Channel, error)
108
109 // GetLiveVideosFunc mocks the GetLiveVideos method.
110 GetLiveVideosFunc func(ctx context.Context) ([]models.Video, error)
111
112 // GetNewVideosFunc mocks the GetNewVideos method.
113 GetNewVideosFunc func(ctx context.Context, sortDesc bool) ([]models.Video, error)
114
115 // GetVideoFunc mocks the GetVideo method.
116 GetVideoFunc func(ctx context.Context, videoID string) (*models.Video, error)
117
118 // GetVideosForCleanupFunc mocks the GetVideosForCleanup method.
119 GetVideosForCleanupFunc func(ctx context.Context, olderThan time.Duration) ([]models.Video, error)
120
121 // GetWatchedVideosFunc mocks the GetWatchedVideos method.
122 GetWatchedVideosFunc func(ctx context.Context, sortDesc bool, limit int, offset int) ([]models.Video, error)
123
124 // HasVideoFunc mocks the HasVideo method.
125 HasVideoFunc func(ctx context.Context, videoID string) (bool, error)
126
127 // ListChannelsFunc mocks the ListChannels method.
128 ListChannelsFunc func(ctx context.Context) ([]models.Channel, error)
129
130 // SetVideoDownloadCompletedFunc mocks the SetVideoDownloadCompleted method.
131 SetVideoDownloadCompletedFunc func(ctx context.Context, videoID string, filePath string) error
132
133 // SetVideoDownloadFailedFunc mocks the SetVideoDownloadFailed method.
134 SetVideoDownloadFailedFunc func(ctx context.Context, videoID string, errorMsg string) error
135
136 // SetVideoDownloadStatusFunc mocks the SetVideoDownloadStatus method.
137 SetVideoDownloadStatusFunc func(ctx context.Context, videoID string, status string) error
138
139 // SetVideoProgressFunc mocks the SetVideoProgress method.
140 SetVideoProgressFunc func(ctx context.Context, videoID string, progress int) (*models.Video, error)
141
142 // SetVideoWatchTimeFunc mocks the SetVideoWatchTime method.
143 SetVideoWatchTimeFunc func(ctx context.Context, videoID string, watchTime *time.Time) error
144
145 // SubscribeToChannelFunc mocks the SubscribeToChannel method.
146 SubscribeToChannelFunc func(ctx context.Context, channel models.Channel) error
147
148 // ToggleChannelShortsFunc mocks the ToggleChannelShorts method.
149 ToggleChannelShortsFunc func(ctx context.Context, channelID string, enableShorts bool) error
150
151 // UnsubscribeFromChannelFunc mocks the UnsubscribeFromChannel method.
152 UnsubscribeFromChannelFunc func(ctx context.Context, channelID string) error
153
154 // UpdateVideoLiveStatusFunc mocks the UpdateVideoLiveStatus method.
155 UpdateVideoLiveStatusFunc func(ctx context.Context, videoID string, isLive bool, duration int) error
156
157 // calls tracks calls to the methods.
158 calls struct {
159 // AddVideo holds details about calls to the AddVideo method.
160 AddVideo []struct {
161 // Ctx is the ctx argument value.
162 Ctx context.Context
163 // Video is the video argument value.
164 Video models.Video
165 // ChannelID is the channelID argument value.
166 ChannelID string
167 // IsDiscarded is the isDiscarded argument value.
168 IsDiscarded bool
169 }
170 // Close holds details about calls to the Close method.
171 Close []struct {
172 }
173 // DeleteVideoFile holds details about calls to the DeleteVideoFile method.
174 DeleteVideoFile []struct {
175 // Ctx is the ctx argument value.
176 Ctx context.Context
177 // VideoID is the videoID argument value.
178 VideoID string
179 }
180 // DiscardVideo holds details about calls to the DiscardVideo method.
181 DiscardVideo []struct {
182 // Ctx is the ctx argument value.
183 Ctx context.Context
184 // VideoID is the videoID argument value.
185 VideoID string
186 }
187 // GetChannelByID holds details about calls to the GetChannelByID method.
188 GetChannelByID []struct {
189 // Ctx is the ctx argument value.
190 Ctx context.Context
191 // ChannelID is the channelID argument value.
192 ChannelID string
193 }
194 // GetLiveVideos holds details about calls to the GetLiveVideos method.
195 GetLiveVideos []struct {
196 // Ctx is the ctx argument value.
197 Ctx context.Context
198 }
199 // GetNewVideos holds details about calls to the GetNewVideos method.
200 GetNewVideos []struct {
201 // Ctx is the ctx argument value.
202 Ctx context.Context
203 // SortDesc is the sortDesc argument value.
204 SortDesc bool
205 }
206 // GetVideo holds details about calls to the GetVideo method.
207 GetVideo []struct {
208 // Ctx is the ctx argument value.
209 Ctx context.Context
210 // VideoID is the videoID argument value.
211 VideoID string
212 }
213 // GetVideosForCleanup holds details about calls to the GetVideosForCleanup method.
214 GetVideosForCleanup []struct {
215 // Ctx is the ctx argument value.
216 Ctx context.Context
217 // OlderThan is the olderThan argument value.
218 OlderThan time.Duration
219 }
220 // GetWatchedVideos holds details about calls to the GetWatchedVideos method.
221 GetWatchedVideos []struct {
222 // Ctx is the ctx argument value.
223 Ctx context.Context
224 // SortDesc is the sortDesc argument value.
225 SortDesc bool
226 // Limit is the limit argument value.
227 Limit int
228 // Offset is the offset argument value.
229 Offset int
230 }
231 // HasVideo holds details about calls to the HasVideo method.
232 HasVideo []struct {
233 // Ctx is the ctx argument value.
234 Ctx context.Context
235 // VideoID is the videoID argument value.
236 VideoID string
237 }
238 // ListChannels holds details about calls to the ListChannels method.
239 ListChannels []struct {
240 // Ctx is the ctx argument value.
241 Ctx context.Context
242 }
243 // SetVideoDownloadCompleted holds details about calls to the SetVideoDownloadCompleted method.
244 SetVideoDownloadCompleted []struct {
245 // Ctx is the ctx argument value.
246 Ctx context.Context
247 // VideoID is the videoID argument value.
248 VideoID string
249 // FilePath is the filePath argument value.
250 FilePath string
251 }
252 // SetVideoDownloadFailed holds details about calls to the SetVideoDownloadFailed method.
253 SetVideoDownloadFailed []struct {
254 // Ctx is the ctx argument value.
255 Ctx context.Context
256 // VideoID is the videoID argument value.
257 VideoID string
258 // ErrorMsg is the errorMsg argument value.
259 ErrorMsg string
260 }
261 // SetVideoDownloadStatus holds details about calls to the SetVideoDownloadStatus method.
262 SetVideoDownloadStatus []struct {
263 // Ctx is the ctx argument value.
264 Ctx context.Context
265 // VideoID is the videoID argument value.
266 VideoID string
267 // Status is the status argument value.
268 Status string
269 }
270 // SetVideoProgress holds details about calls to the SetVideoProgress method.
271 SetVideoProgress []struct {
272 // Ctx is the ctx argument value.
273 Ctx context.Context
274 // VideoID is the videoID argument value.
275 VideoID string
276 // Progress is the progress argument value.
277 Progress int
278 }
279 // SetVideoWatchTime holds details about calls to the SetVideoWatchTime method.
280 SetVideoWatchTime []struct {
281 // Ctx is the ctx argument value.
282 Ctx context.Context
283 // VideoID is the videoID argument value.
284 VideoID string
285 // WatchTime is the watchTime argument value.
286 WatchTime *time.Time
287 }
288 // SubscribeToChannel holds details about calls to the SubscribeToChannel method.
289 SubscribeToChannel []struct {
290 // Ctx is the ctx argument value.
291 Ctx context.Context
292 // Channel is the channel argument value.
293 Channel models.Channel
294 }
295 // ToggleChannelShorts holds details about calls to the ToggleChannelShorts method.
296 ToggleChannelShorts []struct {
297 // Ctx is the ctx argument value.
298 Ctx context.Context
299 // ChannelID is the channelID argument value.
300 ChannelID string
301 // EnableShorts is the enableShorts argument value.
302 EnableShorts bool
303 }
304 // UnsubscribeFromChannel holds details about calls to the UnsubscribeFromChannel method.
305 UnsubscribeFromChannel []struct {
306 // Ctx is the ctx argument value.
307 Ctx context.Context
308 // ChannelID is the channelID argument value.
309 ChannelID string
310 }
311 // UpdateVideoLiveStatus holds details about calls to the UpdateVideoLiveStatus method.
312 UpdateVideoLiveStatus []struct {
313 // Ctx is the ctx argument value.
314 Ctx context.Context
315 // VideoID is the videoID argument value.
316 VideoID string
317 // IsLive is the isLive argument value.
318 IsLive bool
319 // Duration is the duration argument value.
320 Duration int
321 }
322 }
323 lockAddVideo sync.RWMutex
324 lockClose sync.RWMutex
325 lockDeleteVideoFile sync.RWMutex
326 lockDiscardVideo sync.RWMutex
327 lockGetChannelByID sync.RWMutex
328 lockGetLiveVideos sync.RWMutex
329 lockGetNewVideos sync.RWMutex
330 lockGetVideo sync.RWMutex
331 lockGetVideosForCleanup sync.RWMutex
332 lockGetWatchedVideos sync.RWMutex
333 lockHasVideo sync.RWMutex
334 lockListChannels sync.RWMutex
335 lockSetVideoDownloadCompleted sync.RWMutex
336 lockSetVideoDownloadFailed sync.RWMutex
337 lockSetVideoDownloadStatus sync.RWMutex
338 lockSetVideoProgress sync.RWMutex
339 lockSetVideoWatchTime sync.RWMutex
340 lockSubscribeToChannel sync.RWMutex
341 lockToggleChannelShorts sync.RWMutex
342 lockUnsubscribeFromChannel sync.RWMutex
343 lockUpdateVideoLiveStatus sync.RWMutex
344}
345
346// AddVideo calls AddVideoFunc.
347func (mock *DBMock) AddVideo(ctx context.Context, video models.Video, channelID string, isDiscarded bool) error {
348 if mock.AddVideoFunc == nil {
349 panic("DBMock.AddVideoFunc: method is nil but DB.AddVideo was just called")
350 }
351 callInfo := struct {
352 Ctx context.Context
353 Video models.Video
354 ChannelID string
355 IsDiscarded bool
356 }{
357 Ctx: ctx,
358 Video: video,
359 ChannelID: channelID,
360 IsDiscarded: isDiscarded,
361 }
362 mock.lockAddVideo.Lock()
363 mock.calls.AddVideo = append(mock.calls.AddVideo, callInfo)
364 mock.lockAddVideo.Unlock()
365 return mock.AddVideoFunc(ctx, video, channelID, isDiscarded)
366}
367
368// AddVideoCalls gets all the calls that were made to AddVideo.
369// Check the length with:
370//
371// len(mockedDB.AddVideoCalls())
372func (mock *DBMock) AddVideoCalls() []struct {
373 Ctx context.Context
374 Video models.Video
375 ChannelID string
376 IsDiscarded bool
377} {
378 var calls []struct {
379 Ctx context.Context
380 Video models.Video
381 ChannelID string
382 IsDiscarded bool
383 }
384 mock.lockAddVideo.RLock()
385 calls = mock.calls.AddVideo
386 mock.lockAddVideo.RUnlock()
387 return calls
388}
389
390// Close calls CloseFunc.
391func (mock *DBMock) Close() {
392 if mock.CloseFunc == nil {
393 panic("DBMock.CloseFunc: method is nil but DB.Close was just called")
394 }
395 callInfo := struct {
396 }{}
397 mock.lockClose.Lock()
398 mock.calls.Close = append(mock.calls.Close, callInfo)
399 mock.lockClose.Unlock()
400 mock.CloseFunc()
401}
402
403// CloseCalls gets all the calls that were made to Close.
404// Check the length with:
405//
406// len(mockedDB.CloseCalls())
407func (mock *DBMock) CloseCalls() []struct {
408} {
409 var calls []struct {
410 }
411 mock.lockClose.RLock()
412 calls = mock.calls.Close
413 mock.lockClose.RUnlock()
414 return calls
415}
416
417// DeleteVideoFile calls DeleteVideoFileFunc.
418func (mock *DBMock) DeleteVideoFile(ctx context.Context, videoID string) error {
419 if mock.DeleteVideoFileFunc == nil {
420 panic("DBMock.DeleteVideoFileFunc: method is nil but DB.DeleteVideoFile was just called")
421 }
422 callInfo := struct {
423 Ctx context.Context
424 VideoID string
425 }{
426 Ctx: ctx,
427 VideoID: videoID,
428 }
429 mock.lockDeleteVideoFile.Lock()
430 mock.calls.DeleteVideoFile = append(mock.calls.DeleteVideoFile, callInfo)
431 mock.lockDeleteVideoFile.Unlock()
432 return mock.DeleteVideoFileFunc(ctx, videoID)
433}
434
435// DeleteVideoFileCalls gets all the calls that were made to DeleteVideoFile.
436// Check the length with:
437//
438// len(mockedDB.DeleteVideoFileCalls())
439func (mock *DBMock) DeleteVideoFileCalls() []struct {
440 Ctx context.Context
441 VideoID string
442} {
443 var calls []struct {
444 Ctx context.Context
445 VideoID string
446 }
447 mock.lockDeleteVideoFile.RLock()
448 calls = mock.calls.DeleteVideoFile
449 mock.lockDeleteVideoFile.RUnlock()
450 return calls
451}
452
453// DiscardVideo calls DiscardVideoFunc.
454func (mock *DBMock) DiscardVideo(ctx context.Context, videoID string) error {
455 if mock.DiscardVideoFunc == nil {
456 panic("DBMock.DiscardVideoFunc: method is nil but DB.DiscardVideo was just called")
457 }
458 callInfo := struct {
459 Ctx context.Context
460 VideoID string
461 }{
462 Ctx: ctx,
463 VideoID: videoID,
464 }
465 mock.lockDiscardVideo.Lock()
466 mock.calls.DiscardVideo = append(mock.calls.DiscardVideo, callInfo)
467 mock.lockDiscardVideo.Unlock()
468 return mock.DiscardVideoFunc(ctx, videoID)
469}
470
471// DiscardVideoCalls gets all the calls that were made to DiscardVideo.
472// Check the length with:
473//
474// len(mockedDB.DiscardVideoCalls())
475func (mock *DBMock) DiscardVideoCalls() []struct {
476 Ctx context.Context
477 VideoID string
478} {
479 var calls []struct {
480 Ctx context.Context
481 VideoID string
482 }
483 mock.lockDiscardVideo.RLock()
484 calls = mock.calls.DiscardVideo
485 mock.lockDiscardVideo.RUnlock()
486 return calls
487}
488
489// GetChannelByID calls GetChannelByIDFunc.
490func (mock *DBMock) GetChannelByID(ctx context.Context, channelID string) (*models.Channel, error) {
491 if mock.GetChannelByIDFunc == nil {
492 panic("DBMock.GetChannelByIDFunc: method is nil but DB.GetChannelByID was just called")
493 }
494 callInfo := struct {
495 Ctx context.Context
496 ChannelID string
497 }{
498 Ctx: ctx,
499 ChannelID: channelID,
500 }
501 mock.lockGetChannelByID.Lock()
502 mock.calls.GetChannelByID = append(mock.calls.GetChannelByID, callInfo)
503 mock.lockGetChannelByID.Unlock()
504 return mock.GetChannelByIDFunc(ctx, channelID)
505}
506
507// GetChannelByIDCalls gets all the calls that were made to GetChannelByID.
508// Check the length with:
509//
510// len(mockedDB.GetChannelByIDCalls())
511func (mock *DBMock) GetChannelByIDCalls() []struct {
512 Ctx context.Context
513 ChannelID string
514} {
515 var calls []struct {
516 Ctx context.Context
517 ChannelID string
518 }
519 mock.lockGetChannelByID.RLock()
520 calls = mock.calls.GetChannelByID
521 mock.lockGetChannelByID.RUnlock()
522 return calls
523}
524
525// GetLiveVideos calls GetLiveVideosFunc.
526func (mock *DBMock) GetLiveVideos(ctx context.Context) ([]models.Video, error) {
527 if mock.GetLiveVideosFunc == nil {
528 panic("DBMock.GetLiveVideosFunc: method is nil but DB.GetLiveVideos was just called")
529 }
530 callInfo := struct {
531 Ctx context.Context
532 }{
533 Ctx: ctx,
534 }
535 mock.lockGetLiveVideos.Lock()
536 mock.calls.GetLiveVideos = append(mock.calls.GetLiveVideos, callInfo)
537 mock.lockGetLiveVideos.Unlock()
538 return mock.GetLiveVideosFunc(ctx)
539}
540
541// GetLiveVideosCalls gets all the calls that were made to GetLiveVideos.
542// Check the length with:
543//
544// len(mockedDB.GetLiveVideosCalls())
545func (mock *DBMock) GetLiveVideosCalls() []struct {
546 Ctx context.Context
547} {
548 var calls []struct {
549 Ctx context.Context
550 }
551 mock.lockGetLiveVideos.RLock()
552 calls = mock.calls.GetLiveVideos
553 mock.lockGetLiveVideos.RUnlock()
554 return calls
555}
556
557// GetNewVideos calls GetNewVideosFunc.
558func (mock *DBMock) GetNewVideos(ctx context.Context, sortDesc bool) ([]models.Video, error) {
559 if mock.GetNewVideosFunc == nil {
560 panic("DBMock.GetNewVideosFunc: method is nil but DB.GetNewVideos was just called")
561 }
562 callInfo := struct {
563 Ctx context.Context
564 SortDesc bool
565 }{
566 Ctx: ctx,
567 SortDesc: sortDesc,
568 }
569 mock.lockGetNewVideos.Lock()
570 mock.calls.GetNewVideos = append(mock.calls.GetNewVideos, callInfo)
571 mock.lockGetNewVideos.Unlock()
572 return mock.GetNewVideosFunc(ctx, sortDesc)
573}
574
575// GetNewVideosCalls gets all the calls that were made to GetNewVideos.
576// Check the length with:
577//
578// len(mockedDB.GetNewVideosCalls())
579func (mock *DBMock) GetNewVideosCalls() []struct {
580 Ctx context.Context
581 SortDesc bool
582} {
583 var calls []struct {
584 Ctx context.Context
585 SortDesc bool
586 }
587 mock.lockGetNewVideos.RLock()
588 calls = mock.calls.GetNewVideos
589 mock.lockGetNewVideos.RUnlock()
590 return calls
591}
592
593// GetVideo calls GetVideoFunc.
594func (mock *DBMock) GetVideo(ctx context.Context, videoID string) (*models.Video, error) {
595 if mock.GetVideoFunc == nil {
596 panic("DBMock.GetVideoFunc: method is nil but DB.GetVideo was just called")
597 }
598 callInfo := struct {
599 Ctx context.Context
600 VideoID string
601 }{
602 Ctx: ctx,
603 VideoID: videoID,
604 }
605 mock.lockGetVideo.Lock()
606 mock.calls.GetVideo = append(mock.calls.GetVideo, callInfo)
607 mock.lockGetVideo.Unlock()
608 return mock.GetVideoFunc(ctx, videoID)
609}
610
611// GetVideoCalls gets all the calls that were made to GetVideo.
612// Check the length with:
613//
614// len(mockedDB.GetVideoCalls())
615func (mock *DBMock) GetVideoCalls() []struct {
616 Ctx context.Context
617 VideoID string
618} {
619 var calls []struct {
620 Ctx context.Context
621 VideoID string
622 }
623 mock.lockGetVideo.RLock()
624 calls = mock.calls.GetVideo
625 mock.lockGetVideo.RUnlock()
626 return calls
627}
628
629// GetVideosForCleanup calls GetVideosForCleanupFunc.
630func (mock *DBMock) GetVideosForCleanup(ctx context.Context, olderThan time.Duration) ([]models.Video, error) {
631 if mock.GetVideosForCleanupFunc == nil {
632 panic("DBMock.GetVideosForCleanupFunc: method is nil but DB.GetVideosForCleanup was just called")
633 }
634 callInfo := struct {
635 Ctx context.Context
636 OlderThan time.Duration
637 }{
638 Ctx: ctx,
639 OlderThan: olderThan,
640 }
641 mock.lockGetVideosForCleanup.Lock()
642 mock.calls.GetVideosForCleanup = append(mock.calls.GetVideosForCleanup, callInfo)
643 mock.lockGetVideosForCleanup.Unlock()
644 return mock.GetVideosForCleanupFunc(ctx, olderThan)
645}
646
647// GetVideosForCleanupCalls gets all the calls that were made to GetVideosForCleanup.
648// Check the length with:
649//
650// len(mockedDB.GetVideosForCleanupCalls())
651func (mock *DBMock) GetVideosForCleanupCalls() []struct {
652 Ctx context.Context
653 OlderThan time.Duration
654} {
655 var calls []struct {
656 Ctx context.Context
657 OlderThan time.Duration
658 }
659 mock.lockGetVideosForCleanup.RLock()
660 calls = mock.calls.GetVideosForCleanup
661 mock.lockGetVideosForCleanup.RUnlock()
662 return calls
663}
664
665// GetWatchedVideos calls GetWatchedVideosFunc.
666func (mock *DBMock) GetWatchedVideos(ctx context.Context, sortDesc bool, limit int, offset int) ([]models.Video, error) {
667 if mock.GetWatchedVideosFunc == nil {
668 panic("DBMock.GetWatchedVideosFunc: method is nil but DB.GetWatchedVideos was just called")
669 }
670 callInfo := struct {
671 Ctx context.Context
672 SortDesc bool
673 Limit int
674 Offset int
675 }{
676 Ctx: ctx,
677 SortDesc: sortDesc,
678 Limit: limit,
679 Offset: offset,
680 }
681 mock.lockGetWatchedVideos.Lock()
682 mock.calls.GetWatchedVideos = append(mock.calls.GetWatchedVideos, callInfo)
683 mock.lockGetWatchedVideos.Unlock()
684 return mock.GetWatchedVideosFunc(ctx, sortDesc, limit, offset)
685}
686
687// GetWatchedVideosCalls gets all the calls that were made to GetWatchedVideos.
688// Check the length with:
689//
690// len(mockedDB.GetWatchedVideosCalls())
691func (mock *DBMock) GetWatchedVideosCalls() []struct {
692 Ctx context.Context
693 SortDesc bool
694 Limit int
695 Offset int
696} {
697 var calls []struct {
698 Ctx context.Context
699 SortDesc bool
700 Limit int
701 Offset int
702 }
703 mock.lockGetWatchedVideos.RLock()
704 calls = mock.calls.GetWatchedVideos
705 mock.lockGetWatchedVideos.RUnlock()
706 return calls
707}
708
709// HasVideo calls HasVideoFunc.
710func (mock *DBMock) HasVideo(ctx context.Context, videoID string) (bool, error) {
711 if mock.HasVideoFunc == nil {
712 panic("DBMock.HasVideoFunc: method is nil but DB.HasVideo was just called")
713 }
714 callInfo := struct {
715 Ctx context.Context
716 VideoID string
717 }{
718 Ctx: ctx,
719 VideoID: videoID,
720 }
721 mock.lockHasVideo.Lock()
722 mock.calls.HasVideo = append(mock.calls.HasVideo, callInfo)
723 mock.lockHasVideo.Unlock()
724 return mock.HasVideoFunc(ctx, videoID)
725}
726
727// HasVideoCalls gets all the calls that were made to HasVideo.
728// Check the length with:
729//
730// len(mockedDB.HasVideoCalls())
731func (mock *DBMock) HasVideoCalls() []struct {
732 Ctx context.Context
733 VideoID string
734} {
735 var calls []struct {
736 Ctx context.Context
737 VideoID string
738 }
739 mock.lockHasVideo.RLock()
740 calls = mock.calls.HasVideo
741 mock.lockHasVideo.RUnlock()
742 return calls
743}
744
745// ListChannels calls ListChannelsFunc.
746func (mock *DBMock) ListChannels(ctx context.Context) ([]models.Channel, error) {
747 if mock.ListChannelsFunc == nil {
748 panic("DBMock.ListChannelsFunc: method is nil but DB.ListChannels was just called")
749 }
750 callInfo := struct {
751 Ctx context.Context
752 }{
753 Ctx: ctx,
754 }
755 mock.lockListChannels.Lock()
756 mock.calls.ListChannels = append(mock.calls.ListChannels, callInfo)
757 mock.lockListChannels.Unlock()
758 return mock.ListChannelsFunc(ctx)
759}
760
761// ListChannelsCalls gets all the calls that were made to ListChannels.
762// Check the length with:
763//
764// len(mockedDB.ListChannelsCalls())
765func (mock *DBMock) ListChannelsCalls() []struct {
766 Ctx context.Context
767} {
768 var calls []struct {
769 Ctx context.Context
770 }
771 mock.lockListChannels.RLock()
772 calls = mock.calls.ListChannels
773 mock.lockListChannels.RUnlock()
774 return calls
775}
776
777// SetVideoDownloadCompleted calls SetVideoDownloadCompletedFunc.
778func (mock *DBMock) SetVideoDownloadCompleted(ctx context.Context, videoID string, filePath string) error {
779 if mock.SetVideoDownloadCompletedFunc == nil {
780 panic("DBMock.SetVideoDownloadCompletedFunc: method is nil but DB.SetVideoDownloadCompleted was just called")
781 }
782 callInfo := struct {
783 Ctx context.Context
784 VideoID string
785 FilePath string
786 }{
787 Ctx: ctx,
788 VideoID: videoID,
789 FilePath: filePath,
790 }
791 mock.lockSetVideoDownloadCompleted.Lock()
792 mock.calls.SetVideoDownloadCompleted = append(mock.calls.SetVideoDownloadCompleted, callInfo)
793 mock.lockSetVideoDownloadCompleted.Unlock()
794 return mock.SetVideoDownloadCompletedFunc(ctx, videoID, filePath)
795}
796
797// SetVideoDownloadCompletedCalls gets all the calls that were made to SetVideoDownloadCompleted.
798// Check the length with:
799//
800// len(mockedDB.SetVideoDownloadCompletedCalls())
801func (mock *DBMock) SetVideoDownloadCompletedCalls() []struct {
802 Ctx context.Context
803 VideoID string
804 FilePath string
805} {
806 var calls []struct {
807 Ctx context.Context
808 VideoID string
809 FilePath string
810 }
811 mock.lockSetVideoDownloadCompleted.RLock()
812 calls = mock.calls.SetVideoDownloadCompleted
813 mock.lockSetVideoDownloadCompleted.RUnlock()
814 return calls
815}
816
817// SetVideoDownloadFailed calls SetVideoDownloadFailedFunc.
818func (mock *DBMock) SetVideoDownloadFailed(ctx context.Context, videoID string, errorMsg string) error {
819 if mock.SetVideoDownloadFailedFunc == nil {
820 panic("DBMock.SetVideoDownloadFailedFunc: method is nil but DB.SetVideoDownloadFailed was just called")
821 }
822 callInfo := struct {
823 Ctx context.Context
824 VideoID string
825 ErrorMsg string
826 }{
827 Ctx: ctx,
828 VideoID: videoID,
829 ErrorMsg: errorMsg,
830 }
831 mock.lockSetVideoDownloadFailed.Lock()
832 mock.calls.SetVideoDownloadFailed = append(mock.calls.SetVideoDownloadFailed, callInfo)
833 mock.lockSetVideoDownloadFailed.Unlock()
834 return mock.SetVideoDownloadFailedFunc(ctx, videoID, errorMsg)
835}
836
837// SetVideoDownloadFailedCalls gets all the calls that were made to SetVideoDownloadFailed.
838// Check the length with:
839//
840// len(mockedDB.SetVideoDownloadFailedCalls())
841func (mock *DBMock) SetVideoDownloadFailedCalls() []struct {
842 Ctx context.Context
843 VideoID string
844 ErrorMsg string
845} {
846 var calls []struct {
847 Ctx context.Context
848 VideoID string
849 ErrorMsg string
850 }
851 mock.lockSetVideoDownloadFailed.RLock()
852 calls = mock.calls.SetVideoDownloadFailed
853 mock.lockSetVideoDownloadFailed.RUnlock()
854 return calls
855}
856
857// SetVideoDownloadStatus calls SetVideoDownloadStatusFunc.
858func (mock *DBMock) SetVideoDownloadStatus(ctx context.Context, videoID string, status string) error {
859 if mock.SetVideoDownloadStatusFunc == nil {
860 panic("DBMock.SetVideoDownloadStatusFunc: method is nil but DB.SetVideoDownloadStatus was just called")
861 }
862 callInfo := struct {
863 Ctx context.Context
864 VideoID string
865 Status string
866 }{
867 Ctx: ctx,
868 VideoID: videoID,
869 Status: status,
870 }
871 mock.lockSetVideoDownloadStatus.Lock()
872 mock.calls.SetVideoDownloadStatus = append(mock.calls.SetVideoDownloadStatus, callInfo)
873 mock.lockSetVideoDownloadStatus.Unlock()
874 return mock.SetVideoDownloadStatusFunc(ctx, videoID, status)
875}
876
877// SetVideoDownloadStatusCalls gets all the calls that were made to SetVideoDownloadStatus.
878// Check the length with:
879//
880// len(mockedDB.SetVideoDownloadStatusCalls())
881func (mock *DBMock) SetVideoDownloadStatusCalls() []struct {
882 Ctx context.Context
883 VideoID string
884 Status string
885} {
886 var calls []struct {
887 Ctx context.Context
888 VideoID string
889 Status string
890 }
891 mock.lockSetVideoDownloadStatus.RLock()
892 calls = mock.calls.SetVideoDownloadStatus
893 mock.lockSetVideoDownloadStatus.RUnlock()
894 return calls
895}
896
897// SetVideoProgress calls SetVideoProgressFunc.
898func (mock *DBMock) SetVideoProgress(ctx context.Context, videoID string, progress int) (*models.Video, error) {
899 if mock.SetVideoProgressFunc == nil {
900 panic("DBMock.SetVideoProgressFunc: method is nil but DB.SetVideoProgress was just called")
901 }
902 callInfo := struct {
903 Ctx context.Context
904 VideoID string
905 Progress int
906 }{
907 Ctx: ctx,
908 VideoID: videoID,
909 Progress: progress,
910 }
911 mock.lockSetVideoProgress.Lock()
912 mock.calls.SetVideoProgress = append(mock.calls.SetVideoProgress, callInfo)
913 mock.lockSetVideoProgress.Unlock()
914 return mock.SetVideoProgressFunc(ctx, videoID, progress)
915}
916
917// SetVideoProgressCalls gets all the calls that were made to SetVideoProgress.
918// Check the length with:
919//
920// len(mockedDB.SetVideoProgressCalls())
921func (mock *DBMock) SetVideoProgressCalls() []struct {
922 Ctx context.Context
923 VideoID string
924 Progress int
925} {
926 var calls []struct {
927 Ctx context.Context
928 VideoID string
929 Progress int
930 }
931 mock.lockSetVideoProgress.RLock()
932 calls = mock.calls.SetVideoProgress
933 mock.lockSetVideoProgress.RUnlock()
934 return calls
935}
936
937// SetVideoWatchTime calls SetVideoWatchTimeFunc.
938func (mock *DBMock) SetVideoWatchTime(ctx context.Context, videoID string, watchTime *time.Time) error {
939 if mock.SetVideoWatchTimeFunc == nil {
940 panic("DBMock.SetVideoWatchTimeFunc: method is nil but DB.SetVideoWatchTime was just called")
941 }
942 callInfo := struct {
943 Ctx context.Context
944 VideoID string
945 WatchTime *time.Time
946 }{
947 Ctx: ctx,
948 VideoID: videoID,
949 WatchTime: watchTime,
950 }
951 mock.lockSetVideoWatchTime.Lock()
952 mock.calls.SetVideoWatchTime = append(mock.calls.SetVideoWatchTime, callInfo)
953 mock.lockSetVideoWatchTime.Unlock()
954 return mock.SetVideoWatchTimeFunc(ctx, videoID, watchTime)
955}
956
957// SetVideoWatchTimeCalls gets all the calls that were made to SetVideoWatchTime.
958// Check the length with:
959//
960// len(mockedDB.SetVideoWatchTimeCalls())
961func (mock *DBMock) SetVideoWatchTimeCalls() []struct {
962 Ctx context.Context
963 VideoID string
964 WatchTime *time.Time
965} {
966 var calls []struct {
967 Ctx context.Context
968 VideoID string
969 WatchTime *time.Time
970 }
971 mock.lockSetVideoWatchTime.RLock()
972 calls = mock.calls.SetVideoWatchTime
973 mock.lockSetVideoWatchTime.RUnlock()
974 return calls
975}
976
977// SubscribeToChannel calls SubscribeToChannelFunc.
978func (mock *DBMock) SubscribeToChannel(ctx context.Context, channel models.Channel) error {
979 if mock.SubscribeToChannelFunc == nil {
980 panic("DBMock.SubscribeToChannelFunc: method is nil but DB.SubscribeToChannel was just called")
981 }
982 callInfo := struct {
983 Ctx context.Context
984 Channel models.Channel
985 }{
986 Ctx: ctx,
987 Channel: channel,
988 }
989 mock.lockSubscribeToChannel.Lock()
990 mock.calls.SubscribeToChannel = append(mock.calls.SubscribeToChannel, callInfo)
991 mock.lockSubscribeToChannel.Unlock()
992 return mock.SubscribeToChannelFunc(ctx, channel)
993}
994
995// SubscribeToChannelCalls gets all the calls that were made to SubscribeToChannel.
996// Check the length with:
997//
998// len(mockedDB.SubscribeToChannelCalls())
999func (mock *DBMock) SubscribeToChannelCalls() []struct {
1000 Ctx context.Context
1001 Channel models.Channel
1002} {
1003 var calls []struct {
1004 Ctx context.Context
1005 Channel models.Channel
1006 }
1007 mock.lockSubscribeToChannel.RLock()
1008 calls = mock.calls.SubscribeToChannel
1009 mock.lockSubscribeToChannel.RUnlock()
1010 return calls
1011}
1012
1013// ToggleChannelShorts calls ToggleChannelShortsFunc.
1014func (mock *DBMock) ToggleChannelShorts(ctx context.Context, channelID string, enableShorts bool) error {
1015 if mock.ToggleChannelShortsFunc == nil {
1016 panic("DBMock.ToggleChannelShortsFunc: method is nil but DB.ToggleChannelShorts was just called")
1017 }
1018 callInfo := struct {
1019 Ctx context.Context
1020 ChannelID string
1021 EnableShorts bool
1022 }{
1023 Ctx: ctx,
1024 ChannelID: channelID,
1025 EnableShorts: enableShorts,
1026 }
1027 mock.lockToggleChannelShorts.Lock()
1028 mock.calls.ToggleChannelShorts = append(mock.calls.ToggleChannelShorts, callInfo)
1029 mock.lockToggleChannelShorts.Unlock()
1030 return mock.ToggleChannelShortsFunc(ctx, channelID, enableShorts)
1031}
1032
1033// ToggleChannelShortsCalls gets all the calls that were made to ToggleChannelShorts.
1034// Check the length with:
1035//
1036// len(mockedDB.ToggleChannelShortsCalls())
1037func (mock *DBMock) ToggleChannelShortsCalls() []struct {
1038 Ctx context.Context
1039 ChannelID string
1040 EnableShorts bool
1041} {
1042 var calls []struct {
1043 Ctx context.Context
1044 ChannelID string
1045 EnableShorts bool
1046 }
1047 mock.lockToggleChannelShorts.RLock()
1048 calls = mock.calls.ToggleChannelShorts
1049 mock.lockToggleChannelShorts.RUnlock()
1050 return calls
1051}
1052
1053// UnsubscribeFromChannel calls UnsubscribeFromChannelFunc.
1054func (mock *DBMock) UnsubscribeFromChannel(ctx context.Context, channelID string) error {
1055 if mock.UnsubscribeFromChannelFunc == nil {
1056 panic("DBMock.UnsubscribeFromChannelFunc: method is nil but DB.UnsubscribeFromChannel was just called")
1057 }
1058 callInfo := struct {
1059 Ctx context.Context
1060 ChannelID string
1061 }{
1062 Ctx: ctx,
1063 ChannelID: channelID,
1064 }
1065 mock.lockUnsubscribeFromChannel.Lock()
1066 mock.calls.UnsubscribeFromChannel = append(mock.calls.UnsubscribeFromChannel, callInfo)
1067 mock.lockUnsubscribeFromChannel.Unlock()
1068 return mock.UnsubscribeFromChannelFunc(ctx, channelID)
1069}
1070
1071// UnsubscribeFromChannelCalls gets all the calls that were made to UnsubscribeFromChannel.
1072// Check the length with:
1073//
1074// len(mockedDB.UnsubscribeFromChannelCalls())
1075func (mock *DBMock) UnsubscribeFromChannelCalls() []struct {
1076 Ctx context.Context
1077 ChannelID string
1078} {
1079 var calls []struct {
1080 Ctx context.Context
1081 ChannelID string
1082 }
1083 mock.lockUnsubscribeFromChannel.RLock()
1084 calls = mock.calls.UnsubscribeFromChannel
1085 mock.lockUnsubscribeFromChannel.RUnlock()
1086 return calls
1087}
1088
1089// UpdateVideoLiveStatus calls UpdateVideoLiveStatusFunc.
1090func (mock *DBMock) UpdateVideoLiveStatus(ctx context.Context, videoID string, isLive bool, duration int) error {
1091 if mock.UpdateVideoLiveStatusFunc == nil {
1092 panic("DBMock.UpdateVideoLiveStatusFunc: method is nil but DB.UpdateVideoLiveStatus was just called")
1093 }
1094 callInfo := struct {
1095 Ctx context.Context
1096 VideoID string
1097 IsLive bool
1098 Duration int
1099 }{
1100 Ctx: ctx,
1101 VideoID: videoID,
1102 IsLive: isLive,
1103 Duration: duration,
1104 }
1105 mock.lockUpdateVideoLiveStatus.Lock()
1106 mock.calls.UpdateVideoLiveStatus = append(mock.calls.UpdateVideoLiveStatus, callInfo)
1107 mock.lockUpdateVideoLiveStatus.Unlock()
1108 return mock.UpdateVideoLiveStatusFunc(ctx, videoID, isLive, duration)
1109}
1110
1111// UpdateVideoLiveStatusCalls gets all the calls that were made to UpdateVideoLiveStatus.
1112// Check the length with:
1113//
1114// len(mockedDB.UpdateVideoLiveStatusCalls())
1115func (mock *DBMock) UpdateVideoLiveStatusCalls() []struct {
1116 Ctx context.Context
1117 VideoID string
1118 IsLive bool
1119 Duration int
1120} {
1121 var calls []struct {
1122 Ctx context.Context
1123 VideoID string
1124 IsLive bool
1125 Duration int
1126 }
1127 mock.lockUpdateVideoLiveStatus.RLock()
1128 calls = mock.calls.UpdateVideoLiveStatus
1129 mock.lockUpdateVideoLiveStatus.RUnlock()
1130 return calls
1131}