Files
panel/mocks/biz/CacheRepo.go
T
耗子andClaude Opus 4.8 5efb32a661 refactor(biz): 用例层承载业务编排,data 层退为数据/外部原语
将压在 data 层胖 repo 的业务逻辑上移到 biz 用例层,让三层名副其实:
- 34 个 XxxUsecase 从纯透传空壳变为承载领域规则、跨 repo 编排、操作审计的
  真正业务层;data 层 repo 退为数据访问与外部系统原语
- 24 条原压在 repo 层的跨 repo 编排上移为 usecase→usecase/repo 依赖,仅保留
  3 处嵌在外部原语内无法剥离的 repo→repo(backup→setting/website、website→setting)
- 新增 internal/biz/helper.go:operatorID / IsNotFound / containerSock
- 表现层(service/job/command/apps/middleware)零改动,用例对外签名冻结

经全部 34 域逐语句对抗审查确认行为等价,7 处漂移已修复或知情接受。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-10 14:16:10 +08:00

384 lines
9.7 KiB
Go

// Code generated by mockery. DO NOT EDIT.
package biz
import (
biz "github.com/acepanel/panel/v3/internal/biz"
api "github.com/acepanel/panel/v3/pkg/api"
mock "github.com/stretchr/testify/mock"
)
// CacheRepo is an autogenerated mock type for the CacheRepo type
type CacheRepo struct {
mock.Mock
}
type CacheRepo_Expecter struct {
mock *mock.Mock
}
func (_m *CacheRepo) EXPECT() *CacheRepo_Expecter {
return &CacheRepo_Expecter{mock: &_m.Mock}
}
// FetchApps provides a mock function with no fields
func (_m *CacheRepo) FetchApps() (*api.Apps, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for FetchApps")
}
var r0 *api.Apps
var r1 error
if rf, ok := ret.Get(0).(func() (*api.Apps, error)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() *api.Apps); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*api.Apps)
}
}
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// CacheRepo_FetchApps_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FetchApps'
type CacheRepo_FetchApps_Call struct {
*mock.Call
}
// FetchApps is a helper method to define mock.On call
func (_e *CacheRepo_Expecter) FetchApps() *CacheRepo_FetchApps_Call {
return &CacheRepo_FetchApps_Call{Call: _e.mock.On("FetchApps")}
}
func (_c *CacheRepo_FetchApps_Call) Run(run func()) *CacheRepo_FetchApps_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *CacheRepo_FetchApps_Call) Return(_a0 *api.Apps, _a1 error) *CacheRepo_FetchApps_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *CacheRepo_FetchApps_Call) RunAndReturn(run func() (*api.Apps, error)) *CacheRepo_FetchApps_Call {
_c.Call.Return(run)
return _c
}
// FetchCategories provides a mock function with no fields
func (_m *CacheRepo) FetchCategories() (*api.Categories, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for FetchCategories")
}
var r0 *api.Categories
var r1 error
if rf, ok := ret.Get(0).(func() (*api.Categories, error)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() *api.Categories); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*api.Categories)
}
}
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// CacheRepo_FetchCategories_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FetchCategories'
type CacheRepo_FetchCategories_Call struct {
*mock.Call
}
// FetchCategories is a helper method to define mock.On call
func (_e *CacheRepo_Expecter) FetchCategories() *CacheRepo_FetchCategories_Call {
return &CacheRepo_FetchCategories_Call{Call: _e.mock.On("FetchCategories")}
}
func (_c *CacheRepo_FetchCategories_Call) Run(run func()) *CacheRepo_FetchCategories_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *CacheRepo_FetchCategories_Call) Return(_a0 *api.Categories, _a1 error) *CacheRepo_FetchCategories_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *CacheRepo_FetchCategories_Call) RunAndReturn(run func() (*api.Categories, error)) *CacheRepo_FetchCategories_Call {
_c.Call.Return(run)
return _c
}
// FetchEnvironments provides a mock function with no fields
func (_m *CacheRepo) FetchEnvironments() (*api.Environments, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for FetchEnvironments")
}
var r0 *api.Environments
var r1 error
if rf, ok := ret.Get(0).(func() (*api.Environments, error)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() *api.Environments); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*api.Environments)
}
}
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// CacheRepo_FetchEnvironments_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FetchEnvironments'
type CacheRepo_FetchEnvironments_Call struct {
*mock.Call
}
// FetchEnvironments is a helper method to define mock.On call
func (_e *CacheRepo_Expecter) FetchEnvironments() *CacheRepo_FetchEnvironments_Call {
return &CacheRepo_FetchEnvironments_Call{Call: _e.mock.On("FetchEnvironments")}
}
func (_c *CacheRepo_FetchEnvironments_Call) Run(run func()) *CacheRepo_FetchEnvironments_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *CacheRepo_FetchEnvironments_Call) Return(_a0 *api.Environments, _a1 error) *CacheRepo_FetchEnvironments_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *CacheRepo_FetchEnvironments_Call) RunAndReturn(run func() (*api.Environments, error)) *CacheRepo_FetchEnvironments_Call {
_c.Call.Return(run)
return _c
}
// FetchTemplates provides a mock function with no fields
func (_m *CacheRepo) FetchTemplates() (*api.Templates, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for FetchTemplates")
}
var r0 *api.Templates
var r1 error
if rf, ok := ret.Get(0).(func() (*api.Templates, error)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() *api.Templates); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*api.Templates)
}
}
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// CacheRepo_FetchTemplates_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FetchTemplates'
type CacheRepo_FetchTemplates_Call struct {
*mock.Call
}
// FetchTemplates is a helper method to define mock.On call
func (_e *CacheRepo_Expecter) FetchTemplates() *CacheRepo_FetchTemplates_Call {
return &CacheRepo_FetchTemplates_Call{Call: _e.mock.On("FetchTemplates")}
}
func (_c *CacheRepo_FetchTemplates_Call) Run(run func()) *CacheRepo_FetchTemplates_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *CacheRepo_FetchTemplates_Call) Return(_a0 *api.Templates, _a1 error) *CacheRepo_FetchTemplates_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *CacheRepo_FetchTemplates_Call) RunAndReturn(run func() (*api.Templates, error)) *CacheRepo_FetchTemplates_Call {
_c.Call.Return(run)
return _c
}
// Get provides a mock function with given fields: key, defaultValue
func (_m *CacheRepo) Get(key biz.CacheKey, defaultValue ...string) (string, error) {
_va := make([]interface{}, len(defaultValue))
for _i := range defaultValue {
_va[_i] = defaultValue[_i]
}
var _ca []interface{}
_ca = append(_ca, key)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for Get")
}
var r0 string
var r1 error
if rf, ok := ret.Get(0).(func(biz.CacheKey, ...string) (string, error)); ok {
return rf(key, defaultValue...)
}
if rf, ok := ret.Get(0).(func(biz.CacheKey, ...string) string); ok {
r0 = rf(key, defaultValue...)
} else {
r0 = ret.Get(0).(string)
}
if rf, ok := ret.Get(1).(func(biz.CacheKey, ...string) error); ok {
r1 = rf(key, defaultValue...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// CacheRepo_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get'
type CacheRepo_Get_Call struct {
*mock.Call
}
// Get is a helper method to define mock.On call
// - key biz.CacheKey
// - defaultValue ...string
func (_e *CacheRepo_Expecter) Get(key interface{}, defaultValue ...interface{}) *CacheRepo_Get_Call {
return &CacheRepo_Get_Call{Call: _e.mock.On("Get",
append([]interface{}{key}, defaultValue...)...)}
}
func (_c *CacheRepo_Get_Call) Run(run func(key biz.CacheKey, defaultValue ...string)) *CacheRepo_Get_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]string, len(args)-1)
for i, a := range args[1:] {
if a != nil {
variadicArgs[i] = a.(string)
}
}
run(args[0].(biz.CacheKey), variadicArgs...)
})
return _c
}
func (_c *CacheRepo_Get_Call) Return(_a0 string, _a1 error) *CacheRepo_Get_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *CacheRepo_Get_Call) RunAndReturn(run func(biz.CacheKey, ...string) (string, error)) *CacheRepo_Get_Call {
_c.Call.Return(run)
return _c
}
// Set provides a mock function with given fields: key, value
func (_m *CacheRepo) Set(key biz.CacheKey, value string) error {
ret := _m.Called(key, value)
if len(ret) == 0 {
panic("no return value specified for Set")
}
var r0 error
if rf, ok := ret.Get(0).(func(biz.CacheKey, string) error); ok {
r0 = rf(key, value)
} else {
r0 = ret.Error(0)
}
return r0
}
// CacheRepo_Set_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Set'
type CacheRepo_Set_Call struct {
*mock.Call
}
// Set is a helper method to define mock.On call
// - key biz.CacheKey
// - value string
func (_e *CacheRepo_Expecter) Set(key interface{}, value interface{}) *CacheRepo_Set_Call {
return &CacheRepo_Set_Call{Call: _e.mock.On("Set", key, value)}
}
func (_c *CacheRepo_Set_Call) Run(run func(key biz.CacheKey, value string)) *CacheRepo_Set_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(biz.CacheKey), args[1].(string))
})
return _c
}
func (_c *CacheRepo_Set_Call) Return(_a0 error) *CacheRepo_Set_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *CacheRepo_Set_Call) RunAndReturn(run func(biz.CacheKey, string) error) *CacheRepo_Set_Call {
_c.Call.Return(run)
return _c
}
// NewCacheRepo creates a new instance of CacheRepo. 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 NewCacheRepo(t interface {
mock.TestingT
Cleanup(func())
}) *CacheRepo {
mock := &CacheRepo{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}