mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-23 12:16:42 +00:00
This pull request introduces a significant refactoring of the database interaction layer, focusing on improving explicitness, transactional control, and error handling. The core change is the removal of the stateful `QueryExecutor` from repository instances. Instead, it is now passed as an argument to each method that interacts with the database. This change makes transaction management more explicit and flexible, as the same repository instance can be used with a database pool or a specific transaction without needing to be re-instantiated. ### Key Changes - **Explicit `QueryExecutor` Passing:** - All repository methods (`Get`, `List`, `Create`, `Update`, `Delete`, etc.) in `InstanceRepository`, `OrganizationRepository`, `UserRepository`, and their sub-repositories now require a `database.QueryExecutor` (e.g., a `*pgxpool.Pool` or `pgx.Tx`) as the first argument. - Repository constructors no longer accept a `QueryExecutor`. For example, `repository.InstanceRepository(pool)` is now `repository.InstanceRepository()`. - **Enhanced Error Handling:** - A new `database.MissingConditionError` is introduced to enforce required query conditions, such as ensuring an `instance_id` is always present in `UPDATE` and `DELETE` operations. - The database error wrapper in the `postgres` package now correctly identifies and wraps `pgx.ErrTooManyRows` and similar errors from the `scany` library into a `database.MultipleRowsFoundError`. - **Improved Database Conditions:** - The `database.Condition` interface now includes a `ContainsColumn(Column) bool` method. This allows for runtime checks to ensure that critical filters (like `instance_id`) are included in a query, preventing accidental cross-tenant data modification. - A new `database.Exists()` condition has been added to support `EXISTS` subqueries, enabling more complex filtering logic, such as finding an organization that has a specific domain. - **Repository and Interface Refactoring:** - The method for loading related entities (e.g., domains for an organization) has been changed from a boolean flag (`Domains(true)`) to a more explicit, chainable method (`LoadDomains()`). This returns a new repository instance configured to load the sub-resource, promoting immutability. - The custom `OrgIdentifierCondition` has been removed in favor of using the standard `database.Condition` interface, simplifying the API. - **Code Cleanup and Test Updates:** - Unnecessary struct embeddings and metadata have been removed. - All integration and repository tests have been updated to reflect the new method signatures, passing the database pool or transaction object explicitly. - New tests have been added to cover the new `ExistsDomain` functionality and other enhancements. These changes make the data access layer more robust, predictable, and easier to work with, especially in the context of database transactions.
1228 lines
36 KiB
Go
1228 lines
36 KiB
Go
// Code generated by MockGen. DO NOT EDIT.
|
|
// Source: github.com/zitadel/zitadel/backend/v3/storage/database (interfaces: Pool,Connection,Row,Rows,Transaction)
|
|
//
|
|
// Generated by this command:
|
|
//
|
|
// mockgen -typed -package dbmock -destination ./dbmock/database.mock.go github.com/zitadel/zitadel/backend/v3/storage/database Pool,Connection,Row,Rows,Transaction
|
|
//
|
|
|
|
// Package dbmock is a generated GoMock package.
|
|
package dbmock
|
|
|
|
import (
|
|
context "context"
|
|
reflect "reflect"
|
|
|
|
database "github.com/zitadel/zitadel/backend/v3/storage/database"
|
|
gomock "go.uber.org/mock/gomock"
|
|
)
|
|
|
|
// MockPool is a mock of Pool interface.
|
|
type MockPool struct {
|
|
ctrl *gomock.Controller
|
|
recorder *MockPoolMockRecorder
|
|
isgomock struct{}
|
|
}
|
|
|
|
// MockPoolMockRecorder is the mock recorder for MockPool.
|
|
type MockPoolMockRecorder struct {
|
|
mock *MockPool
|
|
}
|
|
|
|
// NewMockPool creates a new mock instance.
|
|
func NewMockPool(ctrl *gomock.Controller) *MockPool {
|
|
mock := &MockPool{ctrl: ctrl}
|
|
mock.recorder = &MockPoolMockRecorder{mock}
|
|
return mock
|
|
}
|
|
|
|
// EXPECT returns an object that allows the caller to indicate expected use.
|
|
func (m *MockPool) EXPECT() *MockPoolMockRecorder {
|
|
return m.recorder
|
|
}
|
|
|
|
// Acquire mocks base method.
|
|
func (m *MockPool) Acquire(ctx context.Context) (database.Connection, error) {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "Acquire", ctx)
|
|
ret0, _ := ret[0].(database.Connection)
|
|
ret1, _ := ret[1].(error)
|
|
return ret0, ret1
|
|
}
|
|
|
|
// Acquire indicates an expected call of Acquire.
|
|
func (mr *MockPoolMockRecorder) Acquire(ctx any) *MockPoolAcquireCall {
|
|
mr.mock.ctrl.T.Helper()
|
|
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Acquire", reflect.TypeOf((*MockPool)(nil).Acquire), ctx)
|
|
return &MockPoolAcquireCall{Call: call}
|
|
}
|
|
|
|
// MockPoolAcquireCall wrap *gomock.Call
|
|
type MockPoolAcquireCall struct {
|
|
*gomock.Call
|
|
}
|
|
|
|
// Return rewrite *gomock.Call.Return
|
|
func (c *MockPoolAcquireCall) Return(arg0 database.Connection, arg1 error) *MockPoolAcquireCall {
|
|
c.Call = c.Call.Return(arg0, arg1)
|
|
return c
|
|
}
|
|
|
|
// Do rewrite *gomock.Call.Do
|
|
func (c *MockPoolAcquireCall) Do(f func(context.Context) (database.Connection, error)) *MockPoolAcquireCall {
|
|
c.Call = c.Call.Do(f)
|
|
return c
|
|
}
|
|
|
|
// DoAndReturn rewrite *gomock.Call.DoAndReturn
|
|
func (c *MockPoolAcquireCall) DoAndReturn(f func(context.Context) (database.Connection, error)) *MockPoolAcquireCall {
|
|
c.Call = c.Call.DoAndReturn(f)
|
|
return c
|
|
}
|
|
|
|
// Begin mocks base method.
|
|
func (m *MockPool) Begin(ctx context.Context, opts *database.TransactionOptions) (database.Transaction, error) {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "Begin", ctx, opts)
|
|
ret0, _ := ret[0].(database.Transaction)
|
|
ret1, _ := ret[1].(error)
|
|
return ret0, ret1
|
|
}
|
|
|
|
// Begin indicates an expected call of Begin.
|
|
func (mr *MockPoolMockRecorder) Begin(ctx, opts any) *MockPoolBeginCall {
|
|
mr.mock.ctrl.T.Helper()
|
|
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Begin", reflect.TypeOf((*MockPool)(nil).Begin), ctx, opts)
|
|
return &MockPoolBeginCall{Call: call}
|
|
}
|
|
|
|
// MockPoolBeginCall wrap *gomock.Call
|
|
type MockPoolBeginCall struct {
|
|
*gomock.Call
|
|
}
|
|
|
|
// Return rewrite *gomock.Call.Return
|
|
func (c *MockPoolBeginCall) Return(arg0 database.Transaction, arg1 error) *MockPoolBeginCall {
|
|
c.Call = c.Call.Return(arg0, arg1)
|
|
return c
|
|
}
|
|
|
|
// Do rewrite *gomock.Call.Do
|
|
func (c *MockPoolBeginCall) Do(f func(context.Context, *database.TransactionOptions) (database.Transaction, error)) *MockPoolBeginCall {
|
|
c.Call = c.Call.Do(f)
|
|
return c
|
|
}
|
|
|
|
// DoAndReturn rewrite *gomock.Call.DoAndReturn
|
|
func (c *MockPoolBeginCall) DoAndReturn(f func(context.Context, *database.TransactionOptions) (database.Transaction, error)) *MockPoolBeginCall {
|
|
c.Call = c.Call.DoAndReturn(f)
|
|
return c
|
|
}
|
|
|
|
// Close mocks base method.
|
|
func (m *MockPool) Close(ctx context.Context) error {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "Close", ctx)
|
|
ret0, _ := ret[0].(error)
|
|
return ret0
|
|
}
|
|
|
|
// Close indicates an expected call of Close.
|
|
func (mr *MockPoolMockRecorder) Close(ctx any) *MockPoolCloseCall {
|
|
mr.mock.ctrl.T.Helper()
|
|
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockPool)(nil).Close), ctx)
|
|
return &MockPoolCloseCall{Call: call}
|
|
}
|
|
|
|
// MockPoolCloseCall wrap *gomock.Call
|
|
type MockPoolCloseCall struct {
|
|
*gomock.Call
|
|
}
|
|
|
|
// Return rewrite *gomock.Call.Return
|
|
func (c *MockPoolCloseCall) Return(arg0 error) *MockPoolCloseCall {
|
|
c.Call = c.Call.Return(arg0)
|
|
return c
|
|
}
|
|
|
|
// Do rewrite *gomock.Call.Do
|
|
func (c *MockPoolCloseCall) Do(f func(context.Context) error) *MockPoolCloseCall {
|
|
c.Call = c.Call.Do(f)
|
|
return c
|
|
}
|
|
|
|
// DoAndReturn rewrite *gomock.Call.DoAndReturn
|
|
func (c *MockPoolCloseCall) DoAndReturn(f func(context.Context) error) *MockPoolCloseCall {
|
|
c.Call = c.Call.DoAndReturn(f)
|
|
return c
|
|
}
|
|
|
|
// Exec mocks base method.
|
|
func (m *MockPool) Exec(ctx context.Context, stmt string, args ...any) (int64, error) {
|
|
m.ctrl.T.Helper()
|
|
varargs := []any{ctx, stmt}
|
|
for _, a := range args {
|
|
varargs = append(varargs, a)
|
|
}
|
|
ret := m.ctrl.Call(m, "Exec", varargs...)
|
|
ret0, _ := ret[0].(int64)
|
|
ret1, _ := ret[1].(error)
|
|
return ret0, ret1
|
|
}
|
|
|
|
// Exec indicates an expected call of Exec.
|
|
func (mr *MockPoolMockRecorder) Exec(ctx, stmt any, args ...any) *MockPoolExecCall {
|
|
mr.mock.ctrl.T.Helper()
|
|
varargs := append([]any{ctx, stmt}, args...)
|
|
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Exec", reflect.TypeOf((*MockPool)(nil).Exec), varargs...)
|
|
return &MockPoolExecCall{Call: call}
|
|
}
|
|
|
|
// MockPoolExecCall wrap *gomock.Call
|
|
type MockPoolExecCall struct {
|
|
*gomock.Call
|
|
}
|
|
|
|
// Return rewrite *gomock.Call.Return
|
|
func (c *MockPoolExecCall) Return(arg0 int64, arg1 error) *MockPoolExecCall {
|
|
c.Call = c.Call.Return(arg0, arg1)
|
|
return c
|
|
}
|
|
|
|
// Do rewrite *gomock.Call.Do
|
|
func (c *MockPoolExecCall) Do(f func(context.Context, string, ...any) (int64, error)) *MockPoolExecCall {
|
|
c.Call = c.Call.Do(f)
|
|
return c
|
|
}
|
|
|
|
// DoAndReturn rewrite *gomock.Call.DoAndReturn
|
|
func (c *MockPoolExecCall) DoAndReturn(f func(context.Context, string, ...any) (int64, error)) *MockPoolExecCall {
|
|
c.Call = c.Call.DoAndReturn(f)
|
|
return c
|
|
}
|
|
|
|
// Migrate mocks base method.
|
|
func (m *MockPool) Migrate(ctx context.Context) error {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "Migrate", ctx)
|
|
ret0, _ := ret[0].(error)
|
|
return ret0
|
|
}
|
|
|
|
// Migrate indicates an expected call of Migrate.
|
|
func (mr *MockPoolMockRecorder) Migrate(ctx any) *MockPoolMigrateCall {
|
|
mr.mock.ctrl.T.Helper()
|
|
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Migrate", reflect.TypeOf((*MockPool)(nil).Migrate), ctx)
|
|
return &MockPoolMigrateCall{Call: call}
|
|
}
|
|
|
|
// MockPoolMigrateCall wrap *gomock.Call
|
|
type MockPoolMigrateCall struct {
|
|
*gomock.Call
|
|
}
|
|
|
|
// Return rewrite *gomock.Call.Return
|
|
func (c *MockPoolMigrateCall) Return(arg0 error) *MockPoolMigrateCall {
|
|
c.Call = c.Call.Return(arg0)
|
|
return c
|
|
}
|
|
|
|
// Do rewrite *gomock.Call.Do
|
|
func (c *MockPoolMigrateCall) Do(f func(context.Context) error) *MockPoolMigrateCall {
|
|
c.Call = c.Call.Do(f)
|
|
return c
|
|
}
|
|
|
|
// DoAndReturn rewrite *gomock.Call.DoAndReturn
|
|
func (c *MockPoolMigrateCall) DoAndReturn(f func(context.Context) error) *MockPoolMigrateCall {
|
|
c.Call = c.Call.DoAndReturn(f)
|
|
return c
|
|
}
|
|
|
|
// Ping mocks base method.
|
|
func (m *MockPool) Ping(ctx context.Context) error {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "Ping", ctx)
|
|
ret0, _ := ret[0].(error)
|
|
return ret0
|
|
}
|
|
|
|
// Ping indicates an expected call of Ping.
|
|
func (mr *MockPoolMockRecorder) Ping(ctx any) *MockPoolPingCall {
|
|
mr.mock.ctrl.T.Helper()
|
|
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Ping", reflect.TypeOf((*MockPool)(nil).Ping), ctx)
|
|
return &MockPoolPingCall{Call: call}
|
|
}
|
|
|
|
// MockPoolPingCall wrap *gomock.Call
|
|
type MockPoolPingCall struct {
|
|
*gomock.Call
|
|
}
|
|
|
|
// Return rewrite *gomock.Call.Return
|
|
func (c *MockPoolPingCall) Return(arg0 error) *MockPoolPingCall {
|
|
c.Call = c.Call.Return(arg0)
|
|
return c
|
|
}
|
|
|
|
// Do rewrite *gomock.Call.Do
|
|
func (c *MockPoolPingCall) Do(f func(context.Context) error) *MockPoolPingCall {
|
|
c.Call = c.Call.Do(f)
|
|
return c
|
|
}
|
|
|
|
// DoAndReturn rewrite *gomock.Call.DoAndReturn
|
|
func (c *MockPoolPingCall) DoAndReturn(f func(context.Context) error) *MockPoolPingCall {
|
|
c.Call = c.Call.DoAndReturn(f)
|
|
return c
|
|
}
|
|
|
|
// Query mocks base method.
|
|
func (m *MockPool) Query(ctx context.Context, stmt string, args ...any) (database.Rows, error) {
|
|
m.ctrl.T.Helper()
|
|
varargs := []any{ctx, stmt}
|
|
for _, a := range args {
|
|
varargs = append(varargs, a)
|
|
}
|
|
ret := m.ctrl.Call(m, "Query", varargs...)
|
|
ret0, _ := ret[0].(database.Rows)
|
|
ret1, _ := ret[1].(error)
|
|
return ret0, ret1
|
|
}
|
|
|
|
// Query indicates an expected call of Query.
|
|
func (mr *MockPoolMockRecorder) Query(ctx, stmt any, args ...any) *MockPoolQueryCall {
|
|
mr.mock.ctrl.T.Helper()
|
|
varargs := append([]any{ctx, stmt}, args...)
|
|
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Query", reflect.TypeOf((*MockPool)(nil).Query), varargs...)
|
|
return &MockPoolQueryCall{Call: call}
|
|
}
|
|
|
|
// MockPoolQueryCall wrap *gomock.Call
|
|
type MockPoolQueryCall struct {
|
|
*gomock.Call
|
|
}
|
|
|
|
// Return rewrite *gomock.Call.Return
|
|
func (c *MockPoolQueryCall) Return(arg0 database.Rows, arg1 error) *MockPoolQueryCall {
|
|
c.Call = c.Call.Return(arg0, arg1)
|
|
return c
|
|
}
|
|
|
|
// Do rewrite *gomock.Call.Do
|
|
func (c *MockPoolQueryCall) Do(f func(context.Context, string, ...any) (database.Rows, error)) *MockPoolQueryCall {
|
|
c.Call = c.Call.Do(f)
|
|
return c
|
|
}
|
|
|
|
// DoAndReturn rewrite *gomock.Call.DoAndReturn
|
|
func (c *MockPoolQueryCall) DoAndReturn(f func(context.Context, string, ...any) (database.Rows, error)) *MockPoolQueryCall {
|
|
c.Call = c.Call.DoAndReturn(f)
|
|
return c
|
|
}
|
|
|
|
// QueryRow mocks base method.
|
|
func (m *MockPool) QueryRow(ctx context.Context, stmt string, args ...any) database.Row {
|
|
m.ctrl.T.Helper()
|
|
varargs := []any{ctx, stmt}
|
|
for _, a := range args {
|
|
varargs = append(varargs, a)
|
|
}
|
|
ret := m.ctrl.Call(m, "QueryRow", varargs...)
|
|
ret0, _ := ret[0].(database.Row)
|
|
return ret0
|
|
}
|
|
|
|
// QueryRow indicates an expected call of QueryRow.
|
|
func (mr *MockPoolMockRecorder) QueryRow(ctx, stmt any, args ...any) *MockPoolQueryRowCall {
|
|
mr.mock.ctrl.T.Helper()
|
|
varargs := append([]any{ctx, stmt}, args...)
|
|
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "QueryRow", reflect.TypeOf((*MockPool)(nil).QueryRow), varargs...)
|
|
return &MockPoolQueryRowCall{Call: call}
|
|
}
|
|
|
|
// MockPoolQueryRowCall wrap *gomock.Call
|
|
type MockPoolQueryRowCall struct {
|
|
*gomock.Call
|
|
}
|
|
|
|
// Return rewrite *gomock.Call.Return
|
|
func (c *MockPoolQueryRowCall) Return(arg0 database.Row) *MockPoolQueryRowCall {
|
|
c.Call = c.Call.Return(arg0)
|
|
return c
|
|
}
|
|
|
|
// Do rewrite *gomock.Call.Do
|
|
func (c *MockPoolQueryRowCall) Do(f func(context.Context, string, ...any) database.Row) *MockPoolQueryRowCall {
|
|
c.Call = c.Call.Do(f)
|
|
return c
|
|
}
|
|
|
|
// DoAndReturn rewrite *gomock.Call.DoAndReturn
|
|
func (c *MockPoolQueryRowCall) DoAndReturn(f func(context.Context, string, ...any) database.Row) *MockPoolQueryRowCall {
|
|
c.Call = c.Call.DoAndReturn(f)
|
|
return c
|
|
}
|
|
|
|
// MockConnection is a mock of Connection interface.
|
|
type MockConnection struct {
|
|
ctrl *gomock.Controller
|
|
recorder *MockConnectionMockRecorder
|
|
isgomock struct{}
|
|
}
|
|
|
|
// MockConnectionMockRecorder is the mock recorder for MockConnection.
|
|
type MockConnectionMockRecorder struct {
|
|
mock *MockConnection
|
|
}
|
|
|
|
// NewMockConnection creates a new mock instance.
|
|
func NewMockConnection(ctrl *gomock.Controller) *MockConnection {
|
|
mock := &MockConnection{ctrl: ctrl}
|
|
mock.recorder = &MockConnectionMockRecorder{mock}
|
|
return mock
|
|
}
|
|
|
|
// EXPECT returns an object that allows the caller to indicate expected use.
|
|
func (m *MockConnection) EXPECT() *MockConnectionMockRecorder {
|
|
return m.recorder
|
|
}
|
|
|
|
// Begin mocks base method.
|
|
func (m *MockConnection) Begin(ctx context.Context, opts *database.TransactionOptions) (database.Transaction, error) {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "Begin", ctx, opts)
|
|
ret0, _ := ret[0].(database.Transaction)
|
|
ret1, _ := ret[1].(error)
|
|
return ret0, ret1
|
|
}
|
|
|
|
// Begin indicates an expected call of Begin.
|
|
func (mr *MockConnectionMockRecorder) Begin(ctx, opts any) *MockConnectionBeginCall {
|
|
mr.mock.ctrl.T.Helper()
|
|
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Begin", reflect.TypeOf((*MockConnection)(nil).Begin), ctx, opts)
|
|
return &MockConnectionBeginCall{Call: call}
|
|
}
|
|
|
|
// MockConnectionBeginCall wrap *gomock.Call
|
|
type MockConnectionBeginCall struct {
|
|
*gomock.Call
|
|
}
|
|
|
|
// Return rewrite *gomock.Call.Return
|
|
func (c *MockConnectionBeginCall) Return(arg0 database.Transaction, arg1 error) *MockConnectionBeginCall {
|
|
c.Call = c.Call.Return(arg0, arg1)
|
|
return c
|
|
}
|
|
|
|
// Do rewrite *gomock.Call.Do
|
|
func (c *MockConnectionBeginCall) Do(f func(context.Context, *database.TransactionOptions) (database.Transaction, error)) *MockConnectionBeginCall {
|
|
c.Call = c.Call.Do(f)
|
|
return c
|
|
}
|
|
|
|
// DoAndReturn rewrite *gomock.Call.DoAndReturn
|
|
func (c *MockConnectionBeginCall) DoAndReturn(f func(context.Context, *database.TransactionOptions) (database.Transaction, error)) *MockConnectionBeginCall {
|
|
c.Call = c.Call.DoAndReturn(f)
|
|
return c
|
|
}
|
|
|
|
// Exec mocks base method.
|
|
func (m *MockConnection) Exec(ctx context.Context, stmt string, args ...any) (int64, error) {
|
|
m.ctrl.T.Helper()
|
|
varargs := []any{ctx, stmt}
|
|
for _, a := range args {
|
|
varargs = append(varargs, a)
|
|
}
|
|
ret := m.ctrl.Call(m, "Exec", varargs...)
|
|
ret0, _ := ret[0].(int64)
|
|
ret1, _ := ret[1].(error)
|
|
return ret0, ret1
|
|
}
|
|
|
|
// Exec indicates an expected call of Exec.
|
|
func (mr *MockConnectionMockRecorder) Exec(ctx, stmt any, args ...any) *MockConnectionExecCall {
|
|
mr.mock.ctrl.T.Helper()
|
|
varargs := append([]any{ctx, stmt}, args...)
|
|
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Exec", reflect.TypeOf((*MockConnection)(nil).Exec), varargs...)
|
|
return &MockConnectionExecCall{Call: call}
|
|
}
|
|
|
|
// MockConnectionExecCall wrap *gomock.Call
|
|
type MockConnectionExecCall struct {
|
|
*gomock.Call
|
|
}
|
|
|
|
// Return rewrite *gomock.Call.Return
|
|
func (c *MockConnectionExecCall) Return(arg0 int64, arg1 error) *MockConnectionExecCall {
|
|
c.Call = c.Call.Return(arg0, arg1)
|
|
return c
|
|
}
|
|
|
|
// Do rewrite *gomock.Call.Do
|
|
func (c *MockConnectionExecCall) Do(f func(context.Context, string, ...any) (int64, error)) *MockConnectionExecCall {
|
|
c.Call = c.Call.Do(f)
|
|
return c
|
|
}
|
|
|
|
// DoAndReturn rewrite *gomock.Call.DoAndReturn
|
|
func (c *MockConnectionExecCall) DoAndReturn(f func(context.Context, string, ...any) (int64, error)) *MockConnectionExecCall {
|
|
c.Call = c.Call.DoAndReturn(f)
|
|
return c
|
|
}
|
|
|
|
// Migrate mocks base method.
|
|
func (m *MockConnection) Migrate(ctx context.Context) error {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "Migrate", ctx)
|
|
ret0, _ := ret[0].(error)
|
|
return ret0
|
|
}
|
|
|
|
// Migrate indicates an expected call of Migrate.
|
|
func (mr *MockConnectionMockRecorder) Migrate(ctx any) *MockConnectionMigrateCall {
|
|
mr.mock.ctrl.T.Helper()
|
|
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Migrate", reflect.TypeOf((*MockConnection)(nil).Migrate), ctx)
|
|
return &MockConnectionMigrateCall{Call: call}
|
|
}
|
|
|
|
// MockConnectionMigrateCall wrap *gomock.Call
|
|
type MockConnectionMigrateCall struct {
|
|
*gomock.Call
|
|
}
|
|
|
|
// Return rewrite *gomock.Call.Return
|
|
func (c *MockConnectionMigrateCall) Return(arg0 error) *MockConnectionMigrateCall {
|
|
c.Call = c.Call.Return(arg0)
|
|
return c
|
|
}
|
|
|
|
// Do rewrite *gomock.Call.Do
|
|
func (c *MockConnectionMigrateCall) Do(f func(context.Context) error) *MockConnectionMigrateCall {
|
|
c.Call = c.Call.Do(f)
|
|
return c
|
|
}
|
|
|
|
// DoAndReturn rewrite *gomock.Call.DoAndReturn
|
|
func (c *MockConnectionMigrateCall) DoAndReturn(f func(context.Context) error) *MockConnectionMigrateCall {
|
|
c.Call = c.Call.DoAndReturn(f)
|
|
return c
|
|
}
|
|
|
|
// Ping mocks base method.
|
|
func (m *MockConnection) Ping(ctx context.Context) error {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "Ping", ctx)
|
|
ret0, _ := ret[0].(error)
|
|
return ret0
|
|
}
|
|
|
|
// Ping indicates an expected call of Ping.
|
|
func (mr *MockConnectionMockRecorder) Ping(ctx any) *MockConnectionPingCall {
|
|
mr.mock.ctrl.T.Helper()
|
|
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Ping", reflect.TypeOf((*MockConnection)(nil).Ping), ctx)
|
|
return &MockConnectionPingCall{Call: call}
|
|
}
|
|
|
|
// MockConnectionPingCall wrap *gomock.Call
|
|
type MockConnectionPingCall struct {
|
|
*gomock.Call
|
|
}
|
|
|
|
// Return rewrite *gomock.Call.Return
|
|
func (c *MockConnectionPingCall) Return(arg0 error) *MockConnectionPingCall {
|
|
c.Call = c.Call.Return(arg0)
|
|
return c
|
|
}
|
|
|
|
// Do rewrite *gomock.Call.Do
|
|
func (c *MockConnectionPingCall) Do(f func(context.Context) error) *MockConnectionPingCall {
|
|
c.Call = c.Call.Do(f)
|
|
return c
|
|
}
|
|
|
|
// DoAndReturn rewrite *gomock.Call.DoAndReturn
|
|
func (c *MockConnectionPingCall) DoAndReturn(f func(context.Context) error) *MockConnectionPingCall {
|
|
c.Call = c.Call.DoAndReturn(f)
|
|
return c
|
|
}
|
|
|
|
// Query mocks base method.
|
|
func (m *MockConnection) Query(ctx context.Context, stmt string, args ...any) (database.Rows, error) {
|
|
m.ctrl.T.Helper()
|
|
varargs := []any{ctx, stmt}
|
|
for _, a := range args {
|
|
varargs = append(varargs, a)
|
|
}
|
|
ret := m.ctrl.Call(m, "Query", varargs...)
|
|
ret0, _ := ret[0].(database.Rows)
|
|
ret1, _ := ret[1].(error)
|
|
return ret0, ret1
|
|
}
|
|
|
|
// Query indicates an expected call of Query.
|
|
func (mr *MockConnectionMockRecorder) Query(ctx, stmt any, args ...any) *MockConnectionQueryCall {
|
|
mr.mock.ctrl.T.Helper()
|
|
varargs := append([]any{ctx, stmt}, args...)
|
|
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Query", reflect.TypeOf((*MockConnection)(nil).Query), varargs...)
|
|
return &MockConnectionQueryCall{Call: call}
|
|
}
|
|
|
|
// MockConnectionQueryCall wrap *gomock.Call
|
|
type MockConnectionQueryCall struct {
|
|
*gomock.Call
|
|
}
|
|
|
|
// Return rewrite *gomock.Call.Return
|
|
func (c *MockConnectionQueryCall) Return(arg0 database.Rows, arg1 error) *MockConnectionQueryCall {
|
|
c.Call = c.Call.Return(arg0, arg1)
|
|
return c
|
|
}
|
|
|
|
// Do rewrite *gomock.Call.Do
|
|
func (c *MockConnectionQueryCall) Do(f func(context.Context, string, ...any) (database.Rows, error)) *MockConnectionQueryCall {
|
|
c.Call = c.Call.Do(f)
|
|
return c
|
|
}
|
|
|
|
// DoAndReturn rewrite *gomock.Call.DoAndReturn
|
|
func (c *MockConnectionQueryCall) DoAndReturn(f func(context.Context, string, ...any) (database.Rows, error)) *MockConnectionQueryCall {
|
|
c.Call = c.Call.DoAndReturn(f)
|
|
return c
|
|
}
|
|
|
|
// QueryRow mocks base method.
|
|
func (m *MockConnection) QueryRow(ctx context.Context, stmt string, args ...any) database.Row {
|
|
m.ctrl.T.Helper()
|
|
varargs := []any{ctx, stmt}
|
|
for _, a := range args {
|
|
varargs = append(varargs, a)
|
|
}
|
|
ret := m.ctrl.Call(m, "QueryRow", varargs...)
|
|
ret0, _ := ret[0].(database.Row)
|
|
return ret0
|
|
}
|
|
|
|
// QueryRow indicates an expected call of QueryRow.
|
|
func (mr *MockConnectionMockRecorder) QueryRow(ctx, stmt any, args ...any) *MockConnectionQueryRowCall {
|
|
mr.mock.ctrl.T.Helper()
|
|
varargs := append([]any{ctx, stmt}, args...)
|
|
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "QueryRow", reflect.TypeOf((*MockConnection)(nil).QueryRow), varargs...)
|
|
return &MockConnectionQueryRowCall{Call: call}
|
|
}
|
|
|
|
// MockConnectionQueryRowCall wrap *gomock.Call
|
|
type MockConnectionQueryRowCall struct {
|
|
*gomock.Call
|
|
}
|
|
|
|
// Return rewrite *gomock.Call.Return
|
|
func (c *MockConnectionQueryRowCall) Return(arg0 database.Row) *MockConnectionQueryRowCall {
|
|
c.Call = c.Call.Return(arg0)
|
|
return c
|
|
}
|
|
|
|
// Do rewrite *gomock.Call.Do
|
|
func (c *MockConnectionQueryRowCall) Do(f func(context.Context, string, ...any) database.Row) *MockConnectionQueryRowCall {
|
|
c.Call = c.Call.Do(f)
|
|
return c
|
|
}
|
|
|
|
// DoAndReturn rewrite *gomock.Call.DoAndReturn
|
|
func (c *MockConnectionQueryRowCall) DoAndReturn(f func(context.Context, string, ...any) database.Row) *MockConnectionQueryRowCall {
|
|
c.Call = c.Call.DoAndReturn(f)
|
|
return c
|
|
}
|
|
|
|
// Release mocks base method.
|
|
func (m *MockConnection) Release(ctx context.Context) error {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "Release", ctx)
|
|
ret0, _ := ret[0].(error)
|
|
return ret0
|
|
}
|
|
|
|
// Release indicates an expected call of Release.
|
|
func (mr *MockConnectionMockRecorder) Release(ctx any) *MockConnectionReleaseCall {
|
|
mr.mock.ctrl.T.Helper()
|
|
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Release", reflect.TypeOf((*MockConnection)(nil).Release), ctx)
|
|
return &MockConnectionReleaseCall{Call: call}
|
|
}
|
|
|
|
// MockConnectionReleaseCall wrap *gomock.Call
|
|
type MockConnectionReleaseCall struct {
|
|
*gomock.Call
|
|
}
|
|
|
|
// Return rewrite *gomock.Call.Return
|
|
func (c *MockConnectionReleaseCall) Return(arg0 error) *MockConnectionReleaseCall {
|
|
c.Call = c.Call.Return(arg0)
|
|
return c
|
|
}
|
|
|
|
// Do rewrite *gomock.Call.Do
|
|
func (c *MockConnectionReleaseCall) Do(f func(context.Context) error) *MockConnectionReleaseCall {
|
|
c.Call = c.Call.Do(f)
|
|
return c
|
|
}
|
|
|
|
// DoAndReturn rewrite *gomock.Call.DoAndReturn
|
|
func (c *MockConnectionReleaseCall) DoAndReturn(f func(context.Context) error) *MockConnectionReleaseCall {
|
|
c.Call = c.Call.DoAndReturn(f)
|
|
return c
|
|
}
|
|
|
|
// MockRow is a mock of Row interface.
|
|
type MockRow struct {
|
|
ctrl *gomock.Controller
|
|
recorder *MockRowMockRecorder
|
|
isgomock struct{}
|
|
}
|
|
|
|
// MockRowMockRecorder is the mock recorder for MockRow.
|
|
type MockRowMockRecorder struct {
|
|
mock *MockRow
|
|
}
|
|
|
|
// NewMockRow creates a new mock instance.
|
|
func NewMockRow(ctrl *gomock.Controller) *MockRow {
|
|
mock := &MockRow{ctrl: ctrl}
|
|
mock.recorder = &MockRowMockRecorder{mock}
|
|
return mock
|
|
}
|
|
|
|
// EXPECT returns an object that allows the caller to indicate expected use.
|
|
func (m *MockRow) EXPECT() *MockRowMockRecorder {
|
|
return m.recorder
|
|
}
|
|
|
|
// Scan mocks base method.
|
|
func (m *MockRow) Scan(dest ...any) error {
|
|
m.ctrl.T.Helper()
|
|
varargs := []any{}
|
|
for _, a := range dest {
|
|
varargs = append(varargs, a)
|
|
}
|
|
ret := m.ctrl.Call(m, "Scan", varargs...)
|
|
ret0, _ := ret[0].(error)
|
|
return ret0
|
|
}
|
|
|
|
// Scan indicates an expected call of Scan.
|
|
func (mr *MockRowMockRecorder) Scan(dest ...any) *MockRowScanCall {
|
|
mr.mock.ctrl.T.Helper()
|
|
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Scan", reflect.TypeOf((*MockRow)(nil).Scan), dest...)
|
|
return &MockRowScanCall{Call: call}
|
|
}
|
|
|
|
// MockRowScanCall wrap *gomock.Call
|
|
type MockRowScanCall struct {
|
|
*gomock.Call
|
|
}
|
|
|
|
// Return rewrite *gomock.Call.Return
|
|
func (c *MockRowScanCall) Return(arg0 error) *MockRowScanCall {
|
|
c.Call = c.Call.Return(arg0)
|
|
return c
|
|
}
|
|
|
|
// Do rewrite *gomock.Call.Do
|
|
func (c *MockRowScanCall) Do(f func(...any) error) *MockRowScanCall {
|
|
c.Call = c.Call.Do(f)
|
|
return c
|
|
}
|
|
|
|
// DoAndReturn rewrite *gomock.Call.DoAndReturn
|
|
func (c *MockRowScanCall) DoAndReturn(f func(...any) error) *MockRowScanCall {
|
|
c.Call = c.Call.DoAndReturn(f)
|
|
return c
|
|
}
|
|
|
|
// MockRows is a mock of Rows interface.
|
|
type MockRows struct {
|
|
ctrl *gomock.Controller
|
|
recorder *MockRowsMockRecorder
|
|
isgomock struct{}
|
|
}
|
|
|
|
// MockRowsMockRecorder is the mock recorder for MockRows.
|
|
type MockRowsMockRecorder struct {
|
|
mock *MockRows
|
|
}
|
|
|
|
// NewMockRows creates a new mock instance.
|
|
func NewMockRows(ctrl *gomock.Controller) *MockRows {
|
|
mock := &MockRows{ctrl: ctrl}
|
|
mock.recorder = &MockRowsMockRecorder{mock}
|
|
return mock
|
|
}
|
|
|
|
// EXPECT returns an object that allows the caller to indicate expected use.
|
|
func (m *MockRows) EXPECT() *MockRowsMockRecorder {
|
|
return m.recorder
|
|
}
|
|
|
|
// Close mocks base method.
|
|
func (m *MockRows) Close() error {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "Close")
|
|
ret0, _ := ret[0].(error)
|
|
return ret0
|
|
}
|
|
|
|
// Close indicates an expected call of Close.
|
|
func (mr *MockRowsMockRecorder) Close() *MockRowsCloseCall {
|
|
mr.mock.ctrl.T.Helper()
|
|
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockRows)(nil).Close))
|
|
return &MockRowsCloseCall{Call: call}
|
|
}
|
|
|
|
// MockRowsCloseCall wrap *gomock.Call
|
|
type MockRowsCloseCall struct {
|
|
*gomock.Call
|
|
}
|
|
|
|
// Return rewrite *gomock.Call.Return
|
|
func (c *MockRowsCloseCall) Return(arg0 error) *MockRowsCloseCall {
|
|
c.Call = c.Call.Return(arg0)
|
|
return c
|
|
}
|
|
|
|
// Do rewrite *gomock.Call.Do
|
|
func (c *MockRowsCloseCall) Do(f func() error) *MockRowsCloseCall {
|
|
c.Call = c.Call.Do(f)
|
|
return c
|
|
}
|
|
|
|
// DoAndReturn rewrite *gomock.Call.DoAndReturn
|
|
func (c *MockRowsCloseCall) DoAndReturn(f func() error) *MockRowsCloseCall {
|
|
c.Call = c.Call.DoAndReturn(f)
|
|
return c
|
|
}
|
|
|
|
// Err mocks base method.
|
|
func (m *MockRows) Err() error {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "Err")
|
|
ret0, _ := ret[0].(error)
|
|
return ret0
|
|
}
|
|
|
|
// Err indicates an expected call of Err.
|
|
func (mr *MockRowsMockRecorder) Err() *MockRowsErrCall {
|
|
mr.mock.ctrl.T.Helper()
|
|
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Err", reflect.TypeOf((*MockRows)(nil).Err))
|
|
return &MockRowsErrCall{Call: call}
|
|
}
|
|
|
|
// MockRowsErrCall wrap *gomock.Call
|
|
type MockRowsErrCall struct {
|
|
*gomock.Call
|
|
}
|
|
|
|
// Return rewrite *gomock.Call.Return
|
|
func (c *MockRowsErrCall) Return(arg0 error) *MockRowsErrCall {
|
|
c.Call = c.Call.Return(arg0)
|
|
return c
|
|
}
|
|
|
|
// Do rewrite *gomock.Call.Do
|
|
func (c *MockRowsErrCall) Do(f func() error) *MockRowsErrCall {
|
|
c.Call = c.Call.Do(f)
|
|
return c
|
|
}
|
|
|
|
// DoAndReturn rewrite *gomock.Call.DoAndReturn
|
|
func (c *MockRowsErrCall) DoAndReturn(f func() error) *MockRowsErrCall {
|
|
c.Call = c.Call.DoAndReturn(f)
|
|
return c
|
|
}
|
|
|
|
// Next mocks base method.
|
|
func (m *MockRows) Next() bool {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "Next")
|
|
ret0, _ := ret[0].(bool)
|
|
return ret0
|
|
}
|
|
|
|
// Next indicates an expected call of Next.
|
|
func (mr *MockRowsMockRecorder) Next() *MockRowsNextCall {
|
|
mr.mock.ctrl.T.Helper()
|
|
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Next", reflect.TypeOf((*MockRows)(nil).Next))
|
|
return &MockRowsNextCall{Call: call}
|
|
}
|
|
|
|
// MockRowsNextCall wrap *gomock.Call
|
|
type MockRowsNextCall struct {
|
|
*gomock.Call
|
|
}
|
|
|
|
// Return rewrite *gomock.Call.Return
|
|
func (c *MockRowsNextCall) Return(arg0 bool) *MockRowsNextCall {
|
|
c.Call = c.Call.Return(arg0)
|
|
return c
|
|
}
|
|
|
|
// Do rewrite *gomock.Call.Do
|
|
func (c *MockRowsNextCall) Do(f func() bool) *MockRowsNextCall {
|
|
c.Call = c.Call.Do(f)
|
|
return c
|
|
}
|
|
|
|
// DoAndReturn rewrite *gomock.Call.DoAndReturn
|
|
func (c *MockRowsNextCall) DoAndReturn(f func() bool) *MockRowsNextCall {
|
|
c.Call = c.Call.DoAndReturn(f)
|
|
return c
|
|
}
|
|
|
|
// Scan mocks base method.
|
|
func (m *MockRows) Scan(dest ...any) error {
|
|
m.ctrl.T.Helper()
|
|
varargs := []any{}
|
|
for _, a := range dest {
|
|
varargs = append(varargs, a)
|
|
}
|
|
ret := m.ctrl.Call(m, "Scan", varargs...)
|
|
ret0, _ := ret[0].(error)
|
|
return ret0
|
|
}
|
|
|
|
// Scan indicates an expected call of Scan.
|
|
func (mr *MockRowsMockRecorder) Scan(dest ...any) *MockRowsScanCall {
|
|
mr.mock.ctrl.T.Helper()
|
|
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Scan", reflect.TypeOf((*MockRows)(nil).Scan), dest...)
|
|
return &MockRowsScanCall{Call: call}
|
|
}
|
|
|
|
// MockRowsScanCall wrap *gomock.Call
|
|
type MockRowsScanCall struct {
|
|
*gomock.Call
|
|
}
|
|
|
|
// Return rewrite *gomock.Call.Return
|
|
func (c *MockRowsScanCall) Return(arg0 error) *MockRowsScanCall {
|
|
c.Call = c.Call.Return(arg0)
|
|
return c
|
|
}
|
|
|
|
// Do rewrite *gomock.Call.Do
|
|
func (c *MockRowsScanCall) Do(f func(...any) error) *MockRowsScanCall {
|
|
c.Call = c.Call.Do(f)
|
|
return c
|
|
}
|
|
|
|
// DoAndReturn rewrite *gomock.Call.DoAndReturn
|
|
func (c *MockRowsScanCall) DoAndReturn(f func(...any) error) *MockRowsScanCall {
|
|
c.Call = c.Call.DoAndReturn(f)
|
|
return c
|
|
}
|
|
|
|
// MockTransaction is a mock of Transaction interface.
|
|
type MockTransaction struct {
|
|
ctrl *gomock.Controller
|
|
recorder *MockTransactionMockRecorder
|
|
isgomock struct{}
|
|
}
|
|
|
|
// MockTransactionMockRecorder is the mock recorder for MockTransaction.
|
|
type MockTransactionMockRecorder struct {
|
|
mock *MockTransaction
|
|
}
|
|
|
|
// NewMockTransaction creates a new mock instance.
|
|
func NewMockTransaction(ctrl *gomock.Controller) *MockTransaction {
|
|
mock := &MockTransaction{ctrl: ctrl}
|
|
mock.recorder = &MockTransactionMockRecorder{mock}
|
|
return mock
|
|
}
|
|
|
|
// EXPECT returns an object that allows the caller to indicate expected use.
|
|
func (m *MockTransaction) EXPECT() *MockTransactionMockRecorder {
|
|
return m.recorder
|
|
}
|
|
|
|
// Begin mocks base method.
|
|
func (m *MockTransaction) Begin(ctx context.Context) (database.Transaction, error) {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "Begin", ctx)
|
|
ret0, _ := ret[0].(database.Transaction)
|
|
ret1, _ := ret[1].(error)
|
|
return ret0, ret1
|
|
}
|
|
|
|
// Begin indicates an expected call of Begin.
|
|
func (mr *MockTransactionMockRecorder) Begin(ctx any) *MockTransactionBeginCall {
|
|
mr.mock.ctrl.T.Helper()
|
|
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Begin", reflect.TypeOf((*MockTransaction)(nil).Begin), ctx)
|
|
return &MockTransactionBeginCall{Call: call}
|
|
}
|
|
|
|
// MockTransactionBeginCall wrap *gomock.Call
|
|
type MockTransactionBeginCall struct {
|
|
*gomock.Call
|
|
}
|
|
|
|
// Return rewrite *gomock.Call.Return
|
|
func (c *MockTransactionBeginCall) Return(arg0 database.Transaction, arg1 error) *MockTransactionBeginCall {
|
|
c.Call = c.Call.Return(arg0, arg1)
|
|
return c
|
|
}
|
|
|
|
// Do rewrite *gomock.Call.Do
|
|
func (c *MockTransactionBeginCall) Do(f func(context.Context) (database.Transaction, error)) *MockTransactionBeginCall {
|
|
c.Call = c.Call.Do(f)
|
|
return c
|
|
}
|
|
|
|
// DoAndReturn rewrite *gomock.Call.DoAndReturn
|
|
func (c *MockTransactionBeginCall) DoAndReturn(f func(context.Context) (database.Transaction, error)) *MockTransactionBeginCall {
|
|
c.Call = c.Call.DoAndReturn(f)
|
|
return c
|
|
}
|
|
|
|
// Commit mocks base method.
|
|
func (m *MockTransaction) Commit(ctx context.Context) error {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "Commit", ctx)
|
|
ret0, _ := ret[0].(error)
|
|
return ret0
|
|
}
|
|
|
|
// Commit indicates an expected call of Commit.
|
|
func (mr *MockTransactionMockRecorder) Commit(ctx any) *MockTransactionCommitCall {
|
|
mr.mock.ctrl.T.Helper()
|
|
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Commit", reflect.TypeOf((*MockTransaction)(nil).Commit), ctx)
|
|
return &MockTransactionCommitCall{Call: call}
|
|
}
|
|
|
|
// MockTransactionCommitCall wrap *gomock.Call
|
|
type MockTransactionCommitCall struct {
|
|
*gomock.Call
|
|
}
|
|
|
|
// Return rewrite *gomock.Call.Return
|
|
func (c *MockTransactionCommitCall) Return(arg0 error) *MockTransactionCommitCall {
|
|
c.Call = c.Call.Return(arg0)
|
|
return c
|
|
}
|
|
|
|
// Do rewrite *gomock.Call.Do
|
|
func (c *MockTransactionCommitCall) Do(f func(context.Context) error) *MockTransactionCommitCall {
|
|
c.Call = c.Call.Do(f)
|
|
return c
|
|
}
|
|
|
|
// DoAndReturn rewrite *gomock.Call.DoAndReturn
|
|
func (c *MockTransactionCommitCall) DoAndReturn(f func(context.Context) error) *MockTransactionCommitCall {
|
|
c.Call = c.Call.DoAndReturn(f)
|
|
return c
|
|
}
|
|
|
|
// End mocks base method.
|
|
func (m *MockTransaction) End(ctx context.Context, err error) error {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "End", ctx, err)
|
|
ret0, _ := ret[0].(error)
|
|
return ret0
|
|
}
|
|
|
|
// End indicates an expected call of End.
|
|
func (mr *MockTransactionMockRecorder) End(ctx, err any) *MockTransactionEndCall {
|
|
mr.mock.ctrl.T.Helper()
|
|
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "End", reflect.TypeOf((*MockTransaction)(nil).End), ctx, err)
|
|
return &MockTransactionEndCall{Call: call}
|
|
}
|
|
|
|
// MockTransactionEndCall wrap *gomock.Call
|
|
type MockTransactionEndCall struct {
|
|
*gomock.Call
|
|
}
|
|
|
|
// Return rewrite *gomock.Call.Return
|
|
func (c *MockTransactionEndCall) Return(arg0 error) *MockTransactionEndCall {
|
|
c.Call = c.Call.Return(arg0)
|
|
return c
|
|
}
|
|
|
|
// Do rewrite *gomock.Call.Do
|
|
func (c *MockTransactionEndCall) Do(f func(context.Context, error) error) *MockTransactionEndCall {
|
|
c.Call = c.Call.Do(f)
|
|
return c
|
|
}
|
|
|
|
// DoAndReturn rewrite *gomock.Call.DoAndReturn
|
|
func (c *MockTransactionEndCall) DoAndReturn(f func(context.Context, error) error) *MockTransactionEndCall {
|
|
c.Call = c.Call.DoAndReturn(f)
|
|
return c
|
|
}
|
|
|
|
// Exec mocks base method.
|
|
func (m *MockTransaction) Exec(ctx context.Context, stmt string, args ...any) (int64, error) {
|
|
m.ctrl.T.Helper()
|
|
varargs := []any{ctx, stmt}
|
|
for _, a := range args {
|
|
varargs = append(varargs, a)
|
|
}
|
|
ret := m.ctrl.Call(m, "Exec", varargs...)
|
|
ret0, _ := ret[0].(int64)
|
|
ret1, _ := ret[1].(error)
|
|
return ret0, ret1
|
|
}
|
|
|
|
// Exec indicates an expected call of Exec.
|
|
func (mr *MockTransactionMockRecorder) Exec(ctx, stmt any, args ...any) *MockTransactionExecCall {
|
|
mr.mock.ctrl.T.Helper()
|
|
varargs := append([]any{ctx, stmt}, args...)
|
|
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Exec", reflect.TypeOf((*MockTransaction)(nil).Exec), varargs...)
|
|
return &MockTransactionExecCall{Call: call}
|
|
}
|
|
|
|
// MockTransactionExecCall wrap *gomock.Call
|
|
type MockTransactionExecCall struct {
|
|
*gomock.Call
|
|
}
|
|
|
|
// Return rewrite *gomock.Call.Return
|
|
func (c *MockTransactionExecCall) Return(arg0 int64, arg1 error) *MockTransactionExecCall {
|
|
c.Call = c.Call.Return(arg0, arg1)
|
|
return c
|
|
}
|
|
|
|
// Do rewrite *gomock.Call.Do
|
|
func (c *MockTransactionExecCall) Do(f func(context.Context, string, ...any) (int64, error)) *MockTransactionExecCall {
|
|
c.Call = c.Call.Do(f)
|
|
return c
|
|
}
|
|
|
|
// DoAndReturn rewrite *gomock.Call.DoAndReturn
|
|
func (c *MockTransactionExecCall) DoAndReturn(f func(context.Context, string, ...any) (int64, error)) *MockTransactionExecCall {
|
|
c.Call = c.Call.DoAndReturn(f)
|
|
return c
|
|
}
|
|
|
|
// Query mocks base method.
|
|
func (m *MockTransaction) Query(ctx context.Context, stmt string, args ...any) (database.Rows, error) {
|
|
m.ctrl.T.Helper()
|
|
varargs := []any{ctx, stmt}
|
|
for _, a := range args {
|
|
varargs = append(varargs, a)
|
|
}
|
|
ret := m.ctrl.Call(m, "Query", varargs...)
|
|
ret0, _ := ret[0].(database.Rows)
|
|
ret1, _ := ret[1].(error)
|
|
return ret0, ret1
|
|
}
|
|
|
|
// Query indicates an expected call of Query.
|
|
func (mr *MockTransactionMockRecorder) Query(ctx, stmt any, args ...any) *MockTransactionQueryCall {
|
|
mr.mock.ctrl.T.Helper()
|
|
varargs := append([]any{ctx, stmt}, args...)
|
|
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Query", reflect.TypeOf((*MockTransaction)(nil).Query), varargs...)
|
|
return &MockTransactionQueryCall{Call: call}
|
|
}
|
|
|
|
// MockTransactionQueryCall wrap *gomock.Call
|
|
type MockTransactionQueryCall struct {
|
|
*gomock.Call
|
|
}
|
|
|
|
// Return rewrite *gomock.Call.Return
|
|
func (c *MockTransactionQueryCall) Return(arg0 database.Rows, arg1 error) *MockTransactionQueryCall {
|
|
c.Call = c.Call.Return(arg0, arg1)
|
|
return c
|
|
}
|
|
|
|
// Do rewrite *gomock.Call.Do
|
|
func (c *MockTransactionQueryCall) Do(f func(context.Context, string, ...any) (database.Rows, error)) *MockTransactionQueryCall {
|
|
c.Call = c.Call.Do(f)
|
|
return c
|
|
}
|
|
|
|
// DoAndReturn rewrite *gomock.Call.DoAndReturn
|
|
func (c *MockTransactionQueryCall) DoAndReturn(f func(context.Context, string, ...any) (database.Rows, error)) *MockTransactionQueryCall {
|
|
c.Call = c.Call.DoAndReturn(f)
|
|
return c
|
|
}
|
|
|
|
// QueryRow mocks base method.
|
|
func (m *MockTransaction) QueryRow(ctx context.Context, stmt string, args ...any) database.Row {
|
|
m.ctrl.T.Helper()
|
|
varargs := []any{ctx, stmt}
|
|
for _, a := range args {
|
|
varargs = append(varargs, a)
|
|
}
|
|
ret := m.ctrl.Call(m, "QueryRow", varargs...)
|
|
ret0, _ := ret[0].(database.Row)
|
|
return ret0
|
|
}
|
|
|
|
// QueryRow indicates an expected call of QueryRow.
|
|
func (mr *MockTransactionMockRecorder) QueryRow(ctx, stmt any, args ...any) *MockTransactionQueryRowCall {
|
|
mr.mock.ctrl.T.Helper()
|
|
varargs := append([]any{ctx, stmt}, args...)
|
|
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "QueryRow", reflect.TypeOf((*MockTransaction)(nil).QueryRow), varargs...)
|
|
return &MockTransactionQueryRowCall{Call: call}
|
|
}
|
|
|
|
// MockTransactionQueryRowCall wrap *gomock.Call
|
|
type MockTransactionQueryRowCall struct {
|
|
*gomock.Call
|
|
}
|
|
|
|
// Return rewrite *gomock.Call.Return
|
|
func (c *MockTransactionQueryRowCall) Return(arg0 database.Row) *MockTransactionQueryRowCall {
|
|
c.Call = c.Call.Return(arg0)
|
|
return c
|
|
}
|
|
|
|
// Do rewrite *gomock.Call.Do
|
|
func (c *MockTransactionQueryRowCall) Do(f func(context.Context, string, ...any) database.Row) *MockTransactionQueryRowCall {
|
|
c.Call = c.Call.Do(f)
|
|
return c
|
|
}
|
|
|
|
// DoAndReturn rewrite *gomock.Call.DoAndReturn
|
|
func (c *MockTransactionQueryRowCall) DoAndReturn(f func(context.Context, string, ...any) database.Row) *MockTransactionQueryRowCall {
|
|
c.Call = c.Call.DoAndReturn(f)
|
|
return c
|
|
}
|
|
|
|
// Rollback mocks base method.
|
|
func (m *MockTransaction) Rollback(ctx context.Context) error {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "Rollback", ctx)
|
|
ret0, _ := ret[0].(error)
|
|
return ret0
|
|
}
|
|
|
|
// Rollback indicates an expected call of Rollback.
|
|
func (mr *MockTransactionMockRecorder) Rollback(ctx any) *MockTransactionRollbackCall {
|
|
mr.mock.ctrl.T.Helper()
|
|
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Rollback", reflect.TypeOf((*MockTransaction)(nil).Rollback), ctx)
|
|
return &MockTransactionRollbackCall{Call: call}
|
|
}
|
|
|
|
// MockTransactionRollbackCall wrap *gomock.Call
|
|
type MockTransactionRollbackCall struct {
|
|
*gomock.Call
|
|
}
|
|
|
|
// Return rewrite *gomock.Call.Return
|
|
func (c *MockTransactionRollbackCall) Return(arg0 error) *MockTransactionRollbackCall {
|
|
c.Call = c.Call.Return(arg0)
|
|
return c
|
|
}
|
|
|
|
// Do rewrite *gomock.Call.Do
|
|
func (c *MockTransactionRollbackCall) Do(f func(context.Context) error) *MockTransactionRollbackCall {
|
|
c.Call = c.Call.Do(f)
|
|
return c
|
|
}
|
|
|
|
// DoAndReturn rewrite *gomock.Call.DoAndReturn
|
|
func (c *MockTransactionRollbackCall) DoAndReturn(f func(context.Context) error) *MockTransactionRollbackCall {
|
|
c.Call = c.Call.DoAndReturn(f)
|
|
return c
|
|
}
|