diff --git a/codebase/interfaces/cache.go b/codebase/interfaces/cache.go index 0c8f6f3..c259b4b 100644 --- a/codebase/interfaces/cache.go +++ b/codebase/interfaces/cache.go @@ -13,4 +13,5 @@ type Cache interface { Set(ctx context.Context, key string, value any, expire time.Duration) error Exists(ctx context.Context, key string) (bool, error) Delete(ctx context.Context, key string) error + DoCommand(ctx context.Context, isWrite bool, command string, args ...any) (reply any, err error) } diff --git a/mocks/codebase/interfaces/Cache.go b/mocks/codebase/interfaces/Cache.go index 7945a1f..ebb9bfe 100644 --- a/mocks/codebase/interfaces/Cache.go +++ b/mocks/codebase/interfaces/Cache.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery v2.49.1. DO NOT EDIT. package mocks @@ -33,6 +33,39 @@ func (_m *Cache) Delete(ctx context.Context, key string) error { return r0 } +// DoCommand provides a mock function with given fields: ctx, isWrite, command, args +func (_m *Cache) DoCommand(ctx context.Context, isWrite bool, command string, args ...interface{}) (interface{}, error) { + var _ca []interface{} + _ca = append(_ca, ctx, isWrite, command) + _ca = append(_ca, args...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for DoCommand") + } + + var r0 interface{} + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, bool, string, ...interface{}) (interface{}, error)); ok { + return rf(ctx, isWrite, command, args...) + } + if rf, ok := ret.Get(0).(func(context.Context, bool, string, ...interface{}) interface{}); ok { + r0 = rf(ctx, isWrite, command, args...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(interface{}) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, bool, string, ...interface{}) error); ok { + r1 = rf(ctx, isWrite, command, args...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // Exists provides a mock function with given fields: ctx, key func (_m *Cache) Exists(ctx context.Context, key string) (bool, error) { ret := _m.Called(ctx, key) @@ -150,7 +183,7 @@ func (_m *Cache) GetTTL(ctx context.Context, key string) (time.Duration, error) } // Set provides a mock function with given fields: ctx, key, value, expire -func (_m *Cache) Set(ctx context.Context, key string, value any, expire time.Duration) error { +func (_m *Cache) Set(ctx context.Context, key string, value interface{}, expire time.Duration) error { ret := _m.Called(ctx, key, value, expire) if len(ret) == 0 { @@ -158,7 +191,7 @@ func (_m *Cache) Set(ctx context.Context, key string, value any, expire time.Dur } var r0 error - if rf, ok := ret.Get(0).(func(context.Context, string, any, time.Duration) error); ok { + if rf, ok := ret.Get(0).(func(context.Context, string, interface{}, time.Duration) error); ok { r0 = rf(ctx, key, value, expire) } else { r0 = ret.Error(0)