Files
panel/mocks/biz/ScanEventRepo.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

527 lines
15 KiB
Go

// Code generated by mockery. DO NOT EDIT.
package biz
import (
biz "github.com/acepanel/panel/v3/internal/biz"
mock "github.com/stretchr/testify/mock"
)
// ScanEventRepo is an autogenerated mock type for the ScanEventRepo type
type ScanEventRepo struct {
mock.Mock
}
type ScanEventRepo_Expecter struct {
mock *mock.Mock
}
func (_m *ScanEventRepo) EXPECT() *ScanEventRepo_Expecter {
return &ScanEventRepo_Expecter{mock: &_m.Mock}
}
// Clear provides a mock function with no fields
func (_m *ScanEventRepo) Clear() error {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Clear")
}
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// ScanEventRepo_Clear_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Clear'
type ScanEventRepo_Clear_Call struct {
*mock.Call
}
// Clear is a helper method to define mock.On call
func (_e *ScanEventRepo_Expecter) Clear() *ScanEventRepo_Clear_Call {
return &ScanEventRepo_Clear_Call{Call: _e.mock.On("Clear")}
}
func (_c *ScanEventRepo_Clear_Call) Run(run func()) *ScanEventRepo_Clear_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *ScanEventRepo_Clear_Call) Return(_a0 error) *ScanEventRepo_Clear_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *ScanEventRepo_Clear_Call) RunAndReturn(run func() error) *ScanEventRepo_Clear_Call {
_c.Call.Return(run)
return _c
}
// ClearBefore provides a mock function with given fields: date
func (_m *ScanEventRepo) ClearBefore(date string) error {
ret := _m.Called(date)
if len(ret) == 0 {
panic("no return value specified for ClearBefore")
}
var r0 error
if rf, ok := ret.Get(0).(func(string) error); ok {
r0 = rf(date)
} else {
r0 = ret.Error(0)
}
return r0
}
// ScanEventRepo_ClearBefore_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ClearBefore'
type ScanEventRepo_ClearBefore_Call struct {
*mock.Call
}
// ClearBefore is a helper method to define mock.On call
// - date string
func (_e *ScanEventRepo_Expecter) ClearBefore(date interface{}) *ScanEventRepo_ClearBefore_Call {
return &ScanEventRepo_ClearBefore_Call{Call: _e.mock.On("ClearBefore", date)}
}
func (_c *ScanEventRepo_ClearBefore_Call) Run(run func(date string)) *ScanEventRepo_ClearBefore_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string))
})
return _c
}
func (_c *ScanEventRepo_ClearBefore_Call) Return(_a0 error) *ScanEventRepo_ClearBefore_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *ScanEventRepo_ClearBefore_Call) RunAndReturn(run func(string) error) *ScanEventRepo_ClearBefore_Call {
_c.Call.Return(run)
return _c
}
// List provides a mock function with given fields: start, end, sourceIP, port, location, page, limit
func (_m *ScanEventRepo) List(start string, end string, sourceIP string, port uint, location string, page uint, limit uint) ([]*biz.ScanEvent, uint, error) {
ret := _m.Called(start, end, sourceIP, port, location, page, limit)
if len(ret) == 0 {
panic("no return value specified for List")
}
var r0 []*biz.ScanEvent
var r1 uint
var r2 error
if rf, ok := ret.Get(0).(func(string, string, string, uint, string, uint, uint) ([]*biz.ScanEvent, uint, error)); ok {
return rf(start, end, sourceIP, port, location, page, limit)
}
if rf, ok := ret.Get(0).(func(string, string, string, uint, string, uint, uint) []*biz.ScanEvent); ok {
r0 = rf(start, end, sourceIP, port, location, page, limit)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*biz.ScanEvent)
}
}
if rf, ok := ret.Get(1).(func(string, string, string, uint, string, uint, uint) uint); ok {
r1 = rf(start, end, sourceIP, port, location, page, limit)
} else {
r1 = ret.Get(1).(uint)
}
if rf, ok := ret.Get(2).(func(string, string, string, uint, string, uint, uint) error); ok {
r2 = rf(start, end, sourceIP, port, location, page, limit)
} else {
r2 = ret.Error(2)
}
return r0, r1, r2
}
// ScanEventRepo_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List'
type ScanEventRepo_List_Call struct {
*mock.Call
}
// List is a helper method to define mock.On call
// - start string
// - end string
// - sourceIP string
// - port uint
// - location string
// - page uint
// - limit uint
func (_e *ScanEventRepo_Expecter) List(start interface{}, end interface{}, sourceIP interface{}, port interface{}, location interface{}, page interface{}, limit interface{}) *ScanEventRepo_List_Call {
return &ScanEventRepo_List_Call{Call: _e.mock.On("List", start, end, sourceIP, port, location, page, limit)}
}
func (_c *ScanEventRepo_List_Call) Run(run func(start string, end string, sourceIP string, port uint, location string, page uint, limit uint)) *ScanEventRepo_List_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string), args[1].(string), args[2].(string), args[3].(uint), args[4].(string), args[5].(uint), args[6].(uint))
})
return _c
}
func (_c *ScanEventRepo_List_Call) Return(_a0 []*biz.ScanEvent, _a1 uint, _a2 error) *ScanEventRepo_List_Call {
_c.Call.Return(_a0, _a1, _a2)
return _c
}
func (_c *ScanEventRepo_List_Call) RunAndReturn(run func(string, string, string, uint, string, uint, uint) ([]*biz.ScanEvent, uint, error)) *ScanEventRepo_List_Call {
_c.Call.Return(run)
return _c
}
// Summary provides a mock function with given fields: start, end
func (_m *ScanEventRepo) Summary(start string, end string) (*biz.ScanSummary, error) {
ret := _m.Called(start, end)
if len(ret) == 0 {
panic("no return value specified for Summary")
}
var r0 *biz.ScanSummary
var r1 error
if rf, ok := ret.Get(0).(func(string, string) (*biz.ScanSummary, error)); ok {
return rf(start, end)
}
if rf, ok := ret.Get(0).(func(string, string) *biz.ScanSummary); ok {
r0 = rf(start, end)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*biz.ScanSummary)
}
}
if rf, ok := ret.Get(1).(func(string, string) error); ok {
r1 = rf(start, end)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ScanEventRepo_Summary_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Summary'
type ScanEventRepo_Summary_Call struct {
*mock.Call
}
// Summary is a helper method to define mock.On call
// - start string
// - end string
func (_e *ScanEventRepo_Expecter) Summary(start interface{}, end interface{}) *ScanEventRepo_Summary_Call {
return &ScanEventRepo_Summary_Call{Call: _e.mock.On("Summary", start, end)}
}
func (_c *ScanEventRepo_Summary_Call) Run(run func(start string, end string)) *ScanEventRepo_Summary_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string), args[1].(string))
})
return _c
}
func (_c *ScanEventRepo_Summary_Call) Return(_a0 *biz.ScanSummary, _a1 error) *ScanEventRepo_Summary_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *ScanEventRepo_Summary_Call) RunAndReturn(run func(string, string) (*biz.ScanSummary, error)) *ScanEventRepo_Summary_Call {
_c.Call.Return(run)
return _c
}
// TopPorts provides a mock function with given fields: start, end, limit
func (_m *ScanEventRepo) TopPorts(start string, end string, limit uint) ([]*biz.ScanPortRank, error) {
ret := _m.Called(start, end, limit)
if len(ret) == 0 {
panic("no return value specified for TopPorts")
}
var r0 []*biz.ScanPortRank
var r1 error
if rf, ok := ret.Get(0).(func(string, string, uint) ([]*biz.ScanPortRank, error)); ok {
return rf(start, end, limit)
}
if rf, ok := ret.Get(0).(func(string, string, uint) []*biz.ScanPortRank); ok {
r0 = rf(start, end, limit)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*biz.ScanPortRank)
}
}
if rf, ok := ret.Get(1).(func(string, string, uint) error); ok {
r1 = rf(start, end, limit)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ScanEventRepo_TopPorts_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TopPorts'
type ScanEventRepo_TopPorts_Call struct {
*mock.Call
}
// TopPorts is a helper method to define mock.On call
// - start string
// - end string
// - limit uint
func (_e *ScanEventRepo_Expecter) TopPorts(start interface{}, end interface{}, limit interface{}) *ScanEventRepo_TopPorts_Call {
return &ScanEventRepo_TopPorts_Call{Call: _e.mock.On("TopPorts", start, end, limit)}
}
func (_c *ScanEventRepo_TopPorts_Call) Run(run func(start string, end string, limit uint)) *ScanEventRepo_TopPorts_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string), args[1].(string), args[2].(uint))
})
return _c
}
func (_c *ScanEventRepo_TopPorts_Call) Return(_a0 []*biz.ScanPortRank, _a1 error) *ScanEventRepo_TopPorts_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *ScanEventRepo_TopPorts_Call) RunAndReturn(run func(string, string, uint) ([]*biz.ScanPortRank, error)) *ScanEventRepo_TopPorts_Call {
_c.Call.Return(run)
return _c
}
// TopSourceIPs provides a mock function with given fields: start, end, limit
func (_m *ScanEventRepo) TopSourceIPs(start string, end string, limit uint) ([]*biz.ScanSourceRank, error) {
ret := _m.Called(start, end, limit)
if len(ret) == 0 {
panic("no return value specified for TopSourceIPs")
}
var r0 []*biz.ScanSourceRank
var r1 error
if rf, ok := ret.Get(0).(func(string, string, uint) ([]*biz.ScanSourceRank, error)); ok {
return rf(start, end, limit)
}
if rf, ok := ret.Get(0).(func(string, string, uint) []*biz.ScanSourceRank); ok {
r0 = rf(start, end, limit)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*biz.ScanSourceRank)
}
}
if rf, ok := ret.Get(1).(func(string, string, uint) error); ok {
r1 = rf(start, end, limit)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ScanEventRepo_TopSourceIPs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TopSourceIPs'
type ScanEventRepo_TopSourceIPs_Call struct {
*mock.Call
}
// TopSourceIPs is a helper method to define mock.On call
// - start string
// - end string
// - limit uint
func (_e *ScanEventRepo_Expecter) TopSourceIPs(start interface{}, end interface{}, limit interface{}) *ScanEventRepo_TopSourceIPs_Call {
return &ScanEventRepo_TopSourceIPs_Call{Call: _e.mock.On("TopSourceIPs", start, end, limit)}
}
func (_c *ScanEventRepo_TopSourceIPs_Call) Run(run func(start string, end string, limit uint)) *ScanEventRepo_TopSourceIPs_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string), args[1].(string), args[2].(uint))
})
return _c
}
func (_c *ScanEventRepo_TopSourceIPs_Call) Return(_a0 []*biz.ScanSourceRank, _a1 error) *ScanEventRepo_TopSourceIPs_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *ScanEventRepo_TopSourceIPs_Call) RunAndReturn(run func(string, string, uint) ([]*biz.ScanSourceRank, error)) *ScanEventRepo_TopSourceIPs_Call {
_c.Call.Return(run)
return _c
}
// Trend provides a mock function with given fields: start, end
func (_m *ScanEventRepo) Trend(start string, end string) ([]*biz.ScanDayTrend, error) {
ret := _m.Called(start, end)
if len(ret) == 0 {
panic("no return value specified for Trend")
}
var r0 []*biz.ScanDayTrend
var r1 error
if rf, ok := ret.Get(0).(func(string, string) ([]*biz.ScanDayTrend, error)); ok {
return rf(start, end)
}
if rf, ok := ret.Get(0).(func(string, string) []*biz.ScanDayTrend); ok {
r0 = rf(start, end)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*biz.ScanDayTrend)
}
}
if rf, ok := ret.Get(1).(func(string, string) error); ok {
r1 = rf(start, end)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ScanEventRepo_Trend_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Trend'
type ScanEventRepo_Trend_Call struct {
*mock.Call
}
// Trend is a helper method to define mock.On call
// - start string
// - end string
func (_e *ScanEventRepo_Expecter) Trend(start interface{}, end interface{}) *ScanEventRepo_Trend_Call {
return &ScanEventRepo_Trend_Call{Call: _e.mock.On("Trend", start, end)}
}
func (_c *ScanEventRepo_Trend_Call) Run(run func(start string, end string)) *ScanEventRepo_Trend_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string), args[1].(string))
})
return _c
}
func (_c *ScanEventRepo_Trend_Call) Return(_a0 []*biz.ScanDayTrend, _a1 error) *ScanEventRepo_Trend_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *ScanEventRepo_Trend_Call) RunAndReturn(run func(string, string) ([]*biz.ScanDayTrend, error)) *ScanEventRepo_Trend_Call {
_c.Call.Return(run)
return _c
}
// Upsert provides a mock function with given fields: events
func (_m *ScanEventRepo) Upsert(events []*biz.ScanEvent) error {
ret := _m.Called(events)
if len(ret) == 0 {
panic("no return value specified for Upsert")
}
var r0 error
if rf, ok := ret.Get(0).(func([]*biz.ScanEvent) error); ok {
r0 = rf(events)
} else {
r0 = ret.Error(0)
}
return r0
}
// ScanEventRepo_Upsert_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Upsert'
type ScanEventRepo_Upsert_Call struct {
*mock.Call
}
// Upsert is a helper method to define mock.On call
// - events []*biz.ScanEvent
func (_e *ScanEventRepo_Expecter) Upsert(events interface{}) *ScanEventRepo_Upsert_Call {
return &ScanEventRepo_Upsert_Call{Call: _e.mock.On("Upsert", events)}
}
func (_c *ScanEventRepo_Upsert_Call) Run(run func(events []*biz.ScanEvent)) *ScanEventRepo_Upsert_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].([]*biz.ScanEvent))
})
return _c
}
func (_c *ScanEventRepo_Upsert_Call) Return(_a0 error) *ScanEventRepo_Upsert_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *ScanEventRepo_Upsert_Call) RunAndReturn(run func([]*biz.ScanEvent) error) *ScanEventRepo_Upsert_Call {
_c.Call.Return(run)
return _c
}
// VacuumDB provides a mock function with no fields
func (_m *ScanEventRepo) VacuumDB() error {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for VacuumDB")
}
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// ScanEventRepo_VacuumDB_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'VacuumDB'
type ScanEventRepo_VacuumDB_Call struct {
*mock.Call
}
// VacuumDB is a helper method to define mock.On call
func (_e *ScanEventRepo_Expecter) VacuumDB() *ScanEventRepo_VacuumDB_Call {
return &ScanEventRepo_VacuumDB_Call{Call: _e.mock.On("VacuumDB")}
}
func (_c *ScanEventRepo_VacuumDB_Call) Run(run func()) *ScanEventRepo_VacuumDB_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *ScanEventRepo_VacuumDB_Call) Return(_a0 error) *ScanEventRepo_VacuumDB_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *ScanEventRepo_VacuumDB_Call) RunAndReturn(run func() error) *ScanEventRepo_VacuumDB_Call {
_c.Call.Return(run)
return _c
}
// NewScanEventRepo creates a new instance of ScanEventRepo. 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 NewScanEventRepo(t interface {
mock.TestingT
Cleanup(func())
}) *ScanEventRepo {
mock := &ScanEventRepo{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}