github.com/projecteru2/core@v0.0.0-20240321043226-06bcc1c23f58/lock/mocks/DistributedLock.go (about) 1 // Code generated by mockery v2.31.4. DO NOT EDIT. 2 3 package mocks 4 5 import ( 6 context "context" 7 8 mock "github.com/stretchr/testify/mock" 9 ) 10 11 // DistributedLock is an autogenerated mock type for the DistributedLock type 12 type DistributedLock struct { 13 mock.Mock 14 } 15 16 // Lock provides a mock function with given fields: ctx 17 func (_m *DistributedLock) Lock(ctx context.Context) (context.Context, error) { 18 ret := _m.Called(ctx) 19 20 var r0 context.Context 21 var r1 error 22 if rf, ok := ret.Get(0).(func(context.Context) (context.Context, error)); ok { 23 return rf(ctx) 24 } 25 if rf, ok := ret.Get(0).(func(context.Context) context.Context); ok { 26 r0 = rf(ctx) 27 } else { 28 if ret.Get(0) != nil { 29 r0 = ret.Get(0).(context.Context) 30 } 31 } 32 33 if rf, ok := ret.Get(1).(func(context.Context) error); ok { 34 r1 = rf(ctx) 35 } else { 36 r1 = ret.Error(1) 37 } 38 39 return r0, r1 40 } 41 42 // TryLock provides a mock function with given fields: ctx 43 func (_m *DistributedLock) TryLock(ctx context.Context) (context.Context, error) { 44 ret := _m.Called(ctx) 45 46 var r0 context.Context 47 var r1 error 48 if rf, ok := ret.Get(0).(func(context.Context) (context.Context, error)); ok { 49 return rf(ctx) 50 } 51 if rf, ok := ret.Get(0).(func(context.Context) context.Context); ok { 52 r0 = rf(ctx) 53 } else { 54 if ret.Get(0) != nil { 55 r0 = ret.Get(0).(context.Context) 56 } 57 } 58 59 if rf, ok := ret.Get(1).(func(context.Context) error); ok { 60 r1 = rf(ctx) 61 } else { 62 r1 = ret.Error(1) 63 } 64 65 return r0, r1 66 } 67 68 // Unlock provides a mock function with given fields: ctx 69 func (_m *DistributedLock) Unlock(ctx context.Context) error { 70 ret := _m.Called(ctx) 71 72 var r0 error 73 if rf, ok := ret.Get(0).(func(context.Context) error); ok { 74 r0 = rf(ctx) 75 } else { 76 r0 = ret.Error(0) 77 } 78 79 return r0 80 } 81 82 // NewDistributedLock creates a new instance of DistributedLock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. 83 // The first argument is typically a *testing.T value. 84 func NewDistributedLock(t interface { 85 mock.TestingT 86 Cleanup(func()) 87 }) *DistributedLock { 88 mock := &DistributedLock{} 89 mock.Mock.Test(t) 90 91 t.Cleanup(func() { mock.AssertExpectations(t) }) 92 93 return mock 94 }