File: cache.go

package info (click to toggle)
gitlab-agent 16.11.5-1
  • links: PTS, VCS
  • area: contrib
  • in suites: experimental
  • size: 7,072 kB
  • sloc: makefile: 193; sh: 55; ruby: 3
file content (115 lines) | stat: -rw-r--r-- 3,624 bytes parent folder | download
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
// Code generated by MockGen. DO NOT EDIT.
// Source: ../../cache/cache_with_err.go
//
// Generated by this command:
//
//	mockgen -typed -source ../../cache/cache_with_err.go -destination cache.go -package mock_cache
//

// Package mock_cache is a generated GoMock package.
package mock_cache

import (
	context "context"
	reflect "reflect"
	time "time"

	gomock "go.uber.org/mock/gomock"
)

// MockErrCacher is a mock of ErrCacher interface.
type MockErrCacher[K any] struct {
	ctrl     *gomock.Controller
	recorder *MockErrCacherMockRecorder[K]
}

// MockErrCacherMockRecorder is the mock recorder for MockErrCacher.
type MockErrCacherMockRecorder[K any] struct {
	mock *MockErrCacher[K]
}

// NewMockErrCacher creates a new mock instance.
func NewMockErrCacher[K any](ctrl *gomock.Controller) *MockErrCacher[K] {
	mock := &MockErrCacher[K]{ctrl: ctrl}
	mock.recorder = &MockErrCacherMockRecorder[K]{mock}
	return mock
}

// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockErrCacher[K]) EXPECT() *MockErrCacherMockRecorder[K] {
	return m.recorder
}

// CacheError mocks base method.
func (m *MockErrCacher[K]) CacheError(ctx context.Context, key K, err error, errTTL time.Duration) {
	m.ctrl.T.Helper()
	m.ctrl.Call(m, "CacheError", ctx, key, err, errTTL)
}

// CacheError indicates an expected call of CacheError.
func (mr *MockErrCacherMockRecorder[K]) CacheError(ctx, key, err, errTTL any) *MockErrCacherCacheErrorCall[K] {
	mr.mock.ctrl.T.Helper()
	call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CacheError", reflect.TypeOf((*MockErrCacher[K])(nil).CacheError), ctx, key, err, errTTL)
	return &MockErrCacherCacheErrorCall[K]{Call: call}
}

// MockErrCacherCacheErrorCall wrap *gomock.Call
type MockErrCacherCacheErrorCall[K any] struct {
	*gomock.Call
}

// Return rewrite *gomock.Call.Return
func (c *MockErrCacherCacheErrorCall[K]) Return() *MockErrCacherCacheErrorCall[K] {
	c.Call = c.Call.Return()
	return c
}

// Do rewrite *gomock.Call.Do
func (c *MockErrCacherCacheErrorCall[K]) Do(f func(context.Context, K, error, time.Duration)) *MockErrCacherCacheErrorCall[K] {
	c.Call = c.Call.Do(f)
	return c
}

// DoAndReturn rewrite *gomock.Call.DoAndReturn
func (c *MockErrCacherCacheErrorCall[K]) DoAndReturn(f func(context.Context, K, error, time.Duration)) *MockErrCacherCacheErrorCall[K] {
	c.Call = c.Call.DoAndReturn(f)
	return c
}

// GetError mocks base method.
func (m *MockErrCacher[K]) GetError(ctx context.Context, key K) error {
	m.ctrl.T.Helper()
	ret := m.ctrl.Call(m, "GetError", ctx, key)
	ret0, _ := ret[0].(error)
	return ret0
}

// GetError indicates an expected call of GetError.
func (mr *MockErrCacherMockRecorder[K]) GetError(ctx, key any) *MockErrCacherGetErrorCall[K] {
	mr.mock.ctrl.T.Helper()
	call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetError", reflect.TypeOf((*MockErrCacher[K])(nil).GetError), ctx, key)
	return &MockErrCacherGetErrorCall[K]{Call: call}
}

// MockErrCacherGetErrorCall wrap *gomock.Call
type MockErrCacherGetErrorCall[K any] struct {
	*gomock.Call
}

// Return rewrite *gomock.Call.Return
func (c *MockErrCacherGetErrorCall[K]) Return(arg0 error) *MockErrCacherGetErrorCall[K] {
	c.Call = c.Call.Return(arg0)
	return c
}

// Do rewrite *gomock.Call.Do
func (c *MockErrCacherGetErrorCall[K]) Do(f func(context.Context, K) error) *MockErrCacherGetErrorCall[K] {
	c.Call = c.Call.Do(f)
	return c
}

// DoAndReturn rewrite *gomock.Call.DoAndReturn
func (c *MockErrCacherGetErrorCall[K]) DoAndReturn(f func(context.Context, K) error) *MockErrCacherGetErrorCall[K] {
	c.Call = c.Call.DoAndReturn(f)
	return c
}