mirror of
https://github.com/grafana/grafana.git
synced 2025-08-01 01:21:50 +08:00
483 lines
13 KiB
Go
483 lines
13 KiB
Go
// Code generated by mockery v2.53.4. DO NOT EDIT.
|
|
|
|
package mocks
|
|
|
|
import (
|
|
context "context"
|
|
|
|
db "github.com/grafana/grafana/pkg/storage/unified/sql/db"
|
|
mock "github.com/stretchr/testify/mock"
|
|
|
|
sql "database/sql"
|
|
)
|
|
|
|
// DB is an autogenerated mock type for the DB type
|
|
type DB struct {
|
|
mock.Mock
|
|
}
|
|
|
|
type DB_Expecter struct {
|
|
mock *mock.Mock
|
|
}
|
|
|
|
func (_m *DB) EXPECT() *DB_Expecter {
|
|
return &DB_Expecter{mock: &_m.Mock}
|
|
}
|
|
|
|
// BeginTx provides a mock function with given fields: _a0, _a1
|
|
func (_m *DB) BeginTx(_a0 context.Context, _a1 *sql.TxOptions) (db.Tx, error) {
|
|
ret := _m.Called(_a0, _a1)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for BeginTx")
|
|
}
|
|
|
|
var r0 db.Tx
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *sql.TxOptions) (db.Tx, error)); ok {
|
|
return rf(_a0, _a1)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, *sql.TxOptions) db.Tx); ok {
|
|
r0 = rf(_a0, _a1)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(db.Tx)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, *sql.TxOptions) error); ok {
|
|
r1 = rf(_a0, _a1)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// DB_BeginTx_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BeginTx'
|
|
type DB_BeginTx_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// BeginTx is a helper method to define mock.On call
|
|
// - _a0 context.Context
|
|
// - _a1 *sql.TxOptions
|
|
func (_e *DB_Expecter) BeginTx(_a0 interface{}, _a1 interface{}) *DB_BeginTx_Call {
|
|
return &DB_BeginTx_Call{Call: _e.mock.On("BeginTx", _a0, _a1)}
|
|
}
|
|
|
|
func (_c *DB_BeginTx_Call) Run(run func(_a0 context.Context, _a1 *sql.TxOptions)) *DB_BeginTx_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context), args[1].(*sql.TxOptions))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *DB_BeginTx_Call) Return(_a0 db.Tx, _a1 error) *DB_BeginTx_Call {
|
|
_c.Call.Return(_a0, _a1)
|
|
return _c
|
|
}
|
|
|
|
func (_c *DB_BeginTx_Call) RunAndReturn(run func(context.Context, *sql.TxOptions) (db.Tx, error)) *DB_BeginTx_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// DriverName provides a mock function with no fields
|
|
func (_m *DB) DriverName() string {
|
|
ret := _m.Called()
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for DriverName")
|
|
}
|
|
|
|
var r0 string
|
|
if rf, ok := ret.Get(0).(func() string); ok {
|
|
r0 = rf()
|
|
} else {
|
|
r0 = ret.Get(0).(string)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// DB_DriverName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DriverName'
|
|
type DB_DriverName_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// DriverName is a helper method to define mock.On call
|
|
func (_e *DB_Expecter) DriverName() *DB_DriverName_Call {
|
|
return &DB_DriverName_Call{Call: _e.mock.On("DriverName")}
|
|
}
|
|
|
|
func (_c *DB_DriverName_Call) Run(run func()) *DB_DriverName_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run()
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *DB_DriverName_Call) Return(_a0 string) *DB_DriverName_Call {
|
|
_c.Call.Return(_a0)
|
|
return _c
|
|
}
|
|
|
|
func (_c *DB_DriverName_Call) RunAndReturn(run func() string) *DB_DriverName_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// ExecContext provides a mock function with given fields: ctx, query, args
|
|
func (_m *DB) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) {
|
|
var _ca []interface{}
|
|
_ca = append(_ca, ctx, query)
|
|
_ca = append(_ca, args...)
|
|
ret := _m.Called(_ca...)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for ExecContext")
|
|
}
|
|
|
|
var r0 sql.Result
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, ...interface{}) (sql.Result, error)); ok {
|
|
return rf(ctx, query, args...)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, ...interface{}) sql.Result); ok {
|
|
r0 = rf(ctx, query, args...)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(sql.Result)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, string, ...interface{}) error); ok {
|
|
r1 = rf(ctx, query, args...)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// DB_ExecContext_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ExecContext'
|
|
type DB_ExecContext_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// ExecContext is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - query string
|
|
// - args ...interface{}
|
|
func (_e *DB_Expecter) ExecContext(ctx interface{}, query interface{}, args ...interface{}) *DB_ExecContext_Call {
|
|
return &DB_ExecContext_Call{Call: _e.mock.On("ExecContext",
|
|
append([]interface{}{ctx, query}, args...)...)}
|
|
}
|
|
|
|
func (_c *DB_ExecContext_Call) Run(run func(ctx context.Context, query string, args ...interface{})) *DB_ExecContext_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
variadicArgs := make([]interface{}, len(args)-2)
|
|
for i, a := range args[2:] {
|
|
if a != nil {
|
|
variadicArgs[i] = a.(interface{})
|
|
}
|
|
}
|
|
run(args[0].(context.Context), args[1].(string), variadicArgs...)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *DB_ExecContext_Call) Return(_a0 sql.Result, _a1 error) *DB_ExecContext_Call {
|
|
_c.Call.Return(_a0, _a1)
|
|
return _c
|
|
}
|
|
|
|
func (_c *DB_ExecContext_Call) RunAndReturn(run func(context.Context, string, ...interface{}) (sql.Result, error)) *DB_ExecContext_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// PingContext provides a mock function with given fields: _a0
|
|
func (_m *DB) PingContext(_a0 context.Context) error {
|
|
ret := _m.Called(_a0)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for PingContext")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context) error); ok {
|
|
r0 = rf(_a0)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// DB_PingContext_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PingContext'
|
|
type DB_PingContext_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// PingContext is a helper method to define mock.On call
|
|
// - _a0 context.Context
|
|
func (_e *DB_Expecter) PingContext(_a0 interface{}) *DB_PingContext_Call {
|
|
return &DB_PingContext_Call{Call: _e.mock.On("PingContext", _a0)}
|
|
}
|
|
|
|
func (_c *DB_PingContext_Call) Run(run func(_a0 context.Context)) *DB_PingContext_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *DB_PingContext_Call) Return(_a0 error) *DB_PingContext_Call {
|
|
_c.Call.Return(_a0)
|
|
return _c
|
|
}
|
|
|
|
func (_c *DB_PingContext_Call) RunAndReturn(run func(context.Context) error) *DB_PingContext_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// QueryContext provides a mock function with given fields: ctx, query, args
|
|
func (_m *DB) QueryContext(ctx context.Context, query string, args ...interface{}) (db.Rows, error) {
|
|
var _ca []interface{}
|
|
_ca = append(_ca, ctx, query)
|
|
_ca = append(_ca, args...)
|
|
ret := _m.Called(_ca...)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for QueryContext")
|
|
}
|
|
|
|
var r0 db.Rows
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, ...interface{}) (db.Rows, error)); ok {
|
|
return rf(ctx, query, args...)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, ...interface{}) db.Rows); ok {
|
|
r0 = rf(ctx, query, args...)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(db.Rows)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, string, ...interface{}) error); ok {
|
|
r1 = rf(ctx, query, args...)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// DB_QueryContext_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'QueryContext'
|
|
type DB_QueryContext_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// QueryContext is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - query string
|
|
// - args ...interface{}
|
|
func (_e *DB_Expecter) QueryContext(ctx interface{}, query interface{}, args ...interface{}) *DB_QueryContext_Call {
|
|
return &DB_QueryContext_Call{Call: _e.mock.On("QueryContext",
|
|
append([]interface{}{ctx, query}, args...)...)}
|
|
}
|
|
|
|
func (_c *DB_QueryContext_Call) Run(run func(ctx context.Context, query string, args ...interface{})) *DB_QueryContext_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
variadicArgs := make([]interface{}, len(args)-2)
|
|
for i, a := range args[2:] {
|
|
if a != nil {
|
|
variadicArgs[i] = a.(interface{})
|
|
}
|
|
}
|
|
run(args[0].(context.Context), args[1].(string), variadicArgs...)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *DB_QueryContext_Call) Return(_a0 db.Rows, _a1 error) *DB_QueryContext_Call {
|
|
_c.Call.Return(_a0, _a1)
|
|
return _c
|
|
}
|
|
|
|
func (_c *DB_QueryContext_Call) RunAndReturn(run func(context.Context, string, ...interface{}) (db.Rows, error)) *DB_QueryContext_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// QueryRowContext provides a mock function with given fields: ctx, query, args
|
|
func (_m *DB) QueryRowContext(ctx context.Context, query string, args ...interface{}) db.Row {
|
|
var _ca []interface{}
|
|
_ca = append(_ca, ctx, query)
|
|
_ca = append(_ca, args...)
|
|
ret := _m.Called(_ca...)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for QueryRowContext")
|
|
}
|
|
|
|
var r0 db.Row
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, ...interface{}) db.Row); ok {
|
|
r0 = rf(ctx, query, args...)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(db.Row)
|
|
}
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// DB_QueryRowContext_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'QueryRowContext'
|
|
type DB_QueryRowContext_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// QueryRowContext is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - query string
|
|
// - args ...interface{}
|
|
func (_e *DB_Expecter) QueryRowContext(ctx interface{}, query interface{}, args ...interface{}) *DB_QueryRowContext_Call {
|
|
return &DB_QueryRowContext_Call{Call: _e.mock.On("QueryRowContext",
|
|
append([]interface{}{ctx, query}, args...)...)}
|
|
}
|
|
|
|
func (_c *DB_QueryRowContext_Call) Run(run func(ctx context.Context, query string, args ...interface{})) *DB_QueryRowContext_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
variadicArgs := make([]interface{}, len(args)-2)
|
|
for i, a := range args[2:] {
|
|
if a != nil {
|
|
variadicArgs[i] = a.(interface{})
|
|
}
|
|
}
|
|
run(args[0].(context.Context), args[1].(string), variadicArgs...)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *DB_QueryRowContext_Call) Return(_a0 db.Row) *DB_QueryRowContext_Call {
|
|
_c.Call.Return(_a0)
|
|
return _c
|
|
}
|
|
|
|
func (_c *DB_QueryRowContext_Call) RunAndReturn(run func(context.Context, string, ...interface{}) db.Row) *DB_QueryRowContext_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// Stats provides a mock function with no fields
|
|
func (_m *DB) Stats() sql.DBStats {
|
|
ret := _m.Called()
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Stats")
|
|
}
|
|
|
|
var r0 sql.DBStats
|
|
if rf, ok := ret.Get(0).(func() sql.DBStats); ok {
|
|
r0 = rf()
|
|
} else {
|
|
r0 = ret.Get(0).(sql.DBStats)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// DB_Stats_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stats'
|
|
type DB_Stats_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Stats is a helper method to define mock.On call
|
|
func (_e *DB_Expecter) Stats() *DB_Stats_Call {
|
|
return &DB_Stats_Call{Call: _e.mock.On("Stats")}
|
|
}
|
|
|
|
func (_c *DB_Stats_Call) Run(run func()) *DB_Stats_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run()
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *DB_Stats_Call) Return(_a0 sql.DBStats) *DB_Stats_Call {
|
|
_c.Call.Return(_a0)
|
|
return _c
|
|
}
|
|
|
|
func (_c *DB_Stats_Call) RunAndReturn(run func() sql.DBStats) *DB_Stats_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// WithTx provides a mock function with given fields: _a0, _a1, _a2
|
|
func (_m *DB) WithTx(_a0 context.Context, _a1 *sql.TxOptions, _a2 func(context.Context, db.Tx) error) error {
|
|
ret := _m.Called(_a0, _a1, _a2)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for WithTx")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *sql.TxOptions, func(context.Context, db.Tx) error) error); ok {
|
|
r0 = rf(_a0, _a1, _a2)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// DB_WithTx_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WithTx'
|
|
type DB_WithTx_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// WithTx is a helper method to define mock.On call
|
|
// - _a0 context.Context
|
|
// - _a1 *sql.TxOptions
|
|
// - _a2 func(context.Context , db.Tx) error
|
|
func (_e *DB_Expecter) WithTx(_a0 interface{}, _a1 interface{}, _a2 interface{}) *DB_WithTx_Call {
|
|
return &DB_WithTx_Call{Call: _e.mock.On("WithTx", _a0, _a1, _a2)}
|
|
}
|
|
|
|
func (_c *DB_WithTx_Call) Run(run func(_a0 context.Context, _a1 *sql.TxOptions, _a2 func(context.Context, db.Tx) error)) *DB_WithTx_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context), args[1].(*sql.TxOptions), args[2].(func(context.Context, db.Tx) error))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *DB_WithTx_Call) Return(_a0 error) *DB_WithTx_Call {
|
|
_c.Call.Return(_a0)
|
|
return _c
|
|
}
|
|
|
|
func (_c *DB_WithTx_Call) RunAndReturn(run func(context.Context, *sql.TxOptions, func(context.Context, db.Tx) error) error) *DB_WithTx_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// NewDB creates a new instance of DB. 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 NewDB(t interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}) *DB {
|
|
mock := &DB{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|