mirror of
https://github.com/rancher/steve.git
synced 2025-06-30 08:42:06 +00:00
* Re-order SQL event hooks so events are last * Add QueryRowContext for single line queries * Add test case for unknown resource version * Properly check rows and close it * More accurate error message when context.Context is canceled * Re-order test check
177 lines
5.2 KiB
Go
177 lines
5.2 KiB
Go
// Code generated by MockGen. DO NOT EDIT.
|
|
// Source: github.com/rancher/steve/pkg/sqlcache/db/transaction (interfaces: Client,Stmt)
|
|
//
|
|
// Generated by this command:
|
|
//
|
|
// mockgen --build_flags=--mod=mod -package db -destination ./transaction_mocks_test.go github.com/rancher/steve/pkg/sqlcache/db/transaction Client,Stmt
|
|
//
|
|
|
|
// Package db is a generated GoMock package.
|
|
package db
|
|
|
|
import (
|
|
context "context"
|
|
sql "database/sql"
|
|
reflect "reflect"
|
|
|
|
transaction "github.com/rancher/steve/pkg/sqlcache/db/transaction"
|
|
gomock "go.uber.org/mock/gomock"
|
|
)
|
|
|
|
// MockClient is a mock of Client interface.
|
|
type MockClient struct {
|
|
ctrl *gomock.Controller
|
|
recorder *MockClientMockRecorder
|
|
}
|
|
|
|
// MockClientMockRecorder is the mock recorder for MockClient.
|
|
type MockClientMockRecorder struct {
|
|
mock *MockClient
|
|
}
|
|
|
|
// NewMockClient creates a new mock instance.
|
|
func NewMockClient(ctrl *gomock.Controller) *MockClient {
|
|
mock := &MockClient{ctrl: ctrl}
|
|
mock.recorder = &MockClientMockRecorder{mock}
|
|
return mock
|
|
}
|
|
|
|
// EXPECT returns an object that allows the caller to indicate expected use.
|
|
func (m *MockClient) EXPECT() *MockClientMockRecorder {
|
|
return m.recorder
|
|
}
|
|
|
|
// Exec mocks base method.
|
|
func (m *MockClient) Exec(arg0 string, arg1 ...any) (sql.Result, error) {
|
|
m.ctrl.T.Helper()
|
|
varargs := []any{arg0}
|
|
for _, a := range arg1 {
|
|
varargs = append(varargs, a)
|
|
}
|
|
ret := m.ctrl.Call(m, "Exec", varargs...)
|
|
ret0, _ := ret[0].(sql.Result)
|
|
ret1, _ := ret[1].(error)
|
|
return ret0, ret1
|
|
}
|
|
|
|
// Exec indicates an expected call of Exec.
|
|
func (mr *MockClientMockRecorder) Exec(arg0 any, arg1 ...any) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
varargs := append([]any{arg0}, arg1...)
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Exec", reflect.TypeOf((*MockClient)(nil).Exec), varargs...)
|
|
}
|
|
|
|
// Stmt mocks base method.
|
|
func (m *MockClient) Stmt(arg0 *sql.Stmt) transaction.Stmt {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "Stmt", arg0)
|
|
ret0, _ := ret[0].(transaction.Stmt)
|
|
return ret0
|
|
}
|
|
|
|
// Stmt indicates an expected call of Stmt.
|
|
func (mr *MockClientMockRecorder) Stmt(arg0 any) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Stmt", reflect.TypeOf((*MockClient)(nil).Stmt), arg0)
|
|
}
|
|
|
|
// MockStmt is a mock of Stmt interface.
|
|
type MockStmt struct {
|
|
ctrl *gomock.Controller
|
|
recorder *MockStmtMockRecorder
|
|
}
|
|
|
|
// MockStmtMockRecorder is the mock recorder for MockStmt.
|
|
type MockStmtMockRecorder struct {
|
|
mock *MockStmt
|
|
}
|
|
|
|
// NewMockStmt creates a new mock instance.
|
|
func NewMockStmt(ctrl *gomock.Controller) *MockStmt {
|
|
mock := &MockStmt{ctrl: ctrl}
|
|
mock.recorder = &MockStmtMockRecorder{mock}
|
|
return mock
|
|
}
|
|
|
|
// EXPECT returns an object that allows the caller to indicate expected use.
|
|
func (m *MockStmt) EXPECT() *MockStmtMockRecorder {
|
|
return m.recorder
|
|
}
|
|
|
|
// Exec mocks base method.
|
|
func (m *MockStmt) Exec(arg0 ...any) (sql.Result, error) {
|
|
m.ctrl.T.Helper()
|
|
varargs := []any{}
|
|
for _, a := range arg0 {
|
|
varargs = append(varargs, a)
|
|
}
|
|
ret := m.ctrl.Call(m, "Exec", varargs...)
|
|
ret0, _ := ret[0].(sql.Result)
|
|
ret1, _ := ret[1].(error)
|
|
return ret0, ret1
|
|
}
|
|
|
|
// Exec indicates an expected call of Exec.
|
|
func (mr *MockStmtMockRecorder) Exec(arg0 ...any) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Exec", reflect.TypeOf((*MockStmt)(nil).Exec), arg0...)
|
|
}
|
|
|
|
// Query mocks base method.
|
|
func (m *MockStmt) Query(arg0 ...any) (*sql.Rows, error) {
|
|
m.ctrl.T.Helper()
|
|
varargs := []any{}
|
|
for _, a := range arg0 {
|
|
varargs = append(varargs, a)
|
|
}
|
|
ret := m.ctrl.Call(m, "Query", varargs...)
|
|
ret0, _ := ret[0].(*sql.Rows)
|
|
ret1, _ := ret[1].(error)
|
|
return ret0, ret1
|
|
}
|
|
|
|
// Query indicates an expected call of Query.
|
|
func (mr *MockStmtMockRecorder) Query(arg0 ...any) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Query", reflect.TypeOf((*MockStmt)(nil).Query), arg0...)
|
|
}
|
|
|
|
// QueryContext mocks base method.
|
|
func (m *MockStmt) QueryContext(arg0 context.Context, arg1 ...any) (*sql.Rows, error) {
|
|
m.ctrl.T.Helper()
|
|
varargs := []any{arg0}
|
|
for _, a := range arg1 {
|
|
varargs = append(varargs, a)
|
|
}
|
|
ret := m.ctrl.Call(m, "QueryContext", varargs...)
|
|
ret0, _ := ret[0].(*sql.Rows)
|
|
ret1, _ := ret[1].(error)
|
|
return ret0, ret1
|
|
}
|
|
|
|
// QueryContext indicates an expected call of QueryContext.
|
|
func (mr *MockStmtMockRecorder) QueryContext(arg0 any, arg1 ...any) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
varargs := append([]any{arg0}, arg1...)
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "QueryContext", reflect.TypeOf((*MockStmt)(nil).QueryContext), varargs...)
|
|
}
|
|
|
|
// QueryRowContext mocks base method.
|
|
func (m *MockStmt) QueryRowContext(arg0 context.Context, arg1 ...any) *sql.Row {
|
|
m.ctrl.T.Helper()
|
|
varargs := []any{arg0}
|
|
for _, a := range arg1 {
|
|
varargs = append(varargs, a)
|
|
}
|
|
ret := m.ctrl.Call(m, "QueryRowContext", varargs...)
|
|
ret0, _ := ret[0].(*sql.Row)
|
|
return ret0
|
|
}
|
|
|
|
// QueryRowContext indicates an expected call of QueryRowContext.
|
|
func (mr *MockStmtMockRecorder) QueryRowContext(arg0 any, arg1 ...any) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
varargs := append([]any{arg0}, arg1...)
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "QueryRowContext", reflect.TypeOf((*MockStmt)(nil).QueryRowContext), varargs...)
|
|
}
|