sqldriver

package
v1.2.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package sqldriver is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDBConnections

func CreateDBConnections(cfg *config.SQL, createConnFunc CreateSingleDBConn) ([]*sqlx.DB, error)

CreateDBConnections returns references to logical connections to the underlying SQL databases. By default when UseMultipleDatabases == false, the returned object is to tied to a single SQL database and the object can be used to perform CRUD operations on the tables in the database. If UseMultipleDatabases == true then return connections to all the databases

Types

type CreateSingleDBConn

type CreateSingleDBConn func(cfg *config.SQL) (*sqlx.DB, error)

type Driver

type Driver interface {

	// BeginTxx starts a new transaction in the shard of dbShardID
	BeginTxx(ctx context.Context, dbShardID int, opts *sql.TxOptions) (*sqlx.Tx, error)
	// Commit commits the current transaction(started by BeginTxx)
	Commit() error
	// Rollback rollbacks the current transaction(started by BeginTxx)
	Rollback() error
	// Close closes this driver(and underlying connections)
	Close() error

	// ExecDDL executes a DDL query
	ExecDDL(ctx context.Context, dbShardID int, query string, args ...interface{}) (sql.Result, error)
	// SelectForSchemaQuery executes a select query for schema(returning multiple rows).
	SelectForSchemaQuery(dbShardID int, dest interface{}, query string, args ...interface{}) error
	// GetForSchemaQuery executes a get query for schema(returning single row).
	GetForSchemaQuery(dbShardID int, dest interface{}, query string, args ...interface{}) error
	// contains filtered or unexported methods
}

Driver interface is an abstraction to query SQL. The layer is added so that we can have a adapter to support multiple SQL databases behind a single Cadence cluster

func NewDriver

func NewDriver(xdbs []*sqlx.DB, tx *sqlx.Tx, dbShardID int) (Driver, error)

NewDriver returns a driver to SQL, either using singleton Driver or sharded Driver

type MockDriver added in v1.2.7

type MockDriver struct {
	// contains filtered or unexported fields
}

MockDriver is a mock of Driver interface.

func NewMockDriver added in v1.2.7

func NewMockDriver(ctrl *gomock.Controller) *MockDriver

NewMockDriver creates a new mock instance.

func (*MockDriver) BeginTxx added in v1.2.7

func (m *MockDriver) BeginTxx(ctx context.Context, dbShardID int, opts *sql.TxOptions) (*sqlx.Tx, error)

BeginTxx mocks base method.

func (*MockDriver) Close added in v1.2.7

func (m *MockDriver) Close() error

Close mocks base method.

func (*MockDriver) Commit added in v1.2.7

func (m *MockDriver) Commit() error

Commit mocks base method.

func (*MockDriver) EXPECT added in v1.2.7

func (m *MockDriver) EXPECT() *MockDriverMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockDriver) ExecContext added in v1.2.7

func (m *MockDriver) ExecContext(ctx context.Context, dbShardID int, query string, args ...interface{}) (sql.Result, error)

ExecContext mocks base method.

func (*MockDriver) ExecDDL added in v1.2.7

func (m *MockDriver) ExecDDL(ctx context.Context, dbShardID int, query string, args ...interface{}) (sql.Result, error)

ExecDDL mocks base method.

func (*MockDriver) GetContext added in v1.2.7

func (m *MockDriver) GetContext(ctx context.Context, dbShardID int, dest interface{}, query string, args ...interface{}) error

GetContext mocks base method.

func (*MockDriver) GetForSchemaQuery added in v1.2.7

func (m *MockDriver) GetForSchemaQuery(dbShardID int, dest interface{}, query string, args ...interface{}) error

GetForSchemaQuery mocks base method.

func (*MockDriver) NamedExecContext added in v1.2.7

func (m *MockDriver) NamedExecContext(ctx context.Context, dbShardID int, query string, arg interface{}) (sql.Result, error)

NamedExecContext mocks base method.

func (*MockDriver) Rollback added in v1.2.7

func (m *MockDriver) Rollback() error

Rollback mocks base method.

func (*MockDriver) SelectContext added in v1.2.7

func (m *MockDriver) SelectContext(ctx context.Context, dbShardID int, dest interface{}, query string, args ...interface{}) error

SelectContext mocks base method.

func (*MockDriver) SelectForSchemaQuery added in v1.2.7

func (m *MockDriver) SelectForSchemaQuery(dbShardID int, dest interface{}, query string, args ...interface{}) error

SelectForSchemaQuery mocks base method.

type MockDriverMockRecorder added in v1.2.7

type MockDriverMockRecorder struct {
	// contains filtered or unexported fields
}

MockDriverMockRecorder is the mock recorder for MockDriver.

func (*MockDriverMockRecorder) BeginTxx added in v1.2.7

func (mr *MockDriverMockRecorder) BeginTxx(ctx, dbShardID, opts interface{}) *gomock.Call

BeginTxx indicates an expected call of BeginTxx.

func (*MockDriverMockRecorder) Close added in v1.2.7

func (mr *MockDriverMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close.

func (*MockDriverMockRecorder) Commit added in v1.2.7

func (mr *MockDriverMockRecorder) Commit() *gomock.Call

Commit indicates an expected call of Commit.

func (*MockDriverMockRecorder) ExecContext added in v1.2.7

func (mr *MockDriverMockRecorder) ExecContext(ctx, dbShardID, query interface{}, args ...interface{}) *gomock.Call

ExecContext indicates an expected call of ExecContext.

func (*MockDriverMockRecorder) ExecDDL added in v1.2.7

func (mr *MockDriverMockRecorder) ExecDDL(ctx, dbShardID, query interface{}, args ...interface{}) *gomock.Call

ExecDDL indicates an expected call of ExecDDL.

func (*MockDriverMockRecorder) GetContext added in v1.2.7

func (mr *MockDriverMockRecorder) GetContext(ctx, dbShardID, dest, query interface{}, args ...interface{}) *gomock.Call

GetContext indicates an expected call of GetContext.

func (*MockDriverMockRecorder) GetForSchemaQuery added in v1.2.7

func (mr *MockDriverMockRecorder) GetForSchemaQuery(dbShardID, dest, query interface{}, args ...interface{}) *gomock.Call

GetForSchemaQuery indicates an expected call of GetForSchemaQuery.

func (*MockDriverMockRecorder) NamedExecContext added in v1.2.7

func (mr *MockDriverMockRecorder) NamedExecContext(ctx, dbShardID, query, arg interface{}) *gomock.Call

NamedExecContext indicates an expected call of NamedExecContext.

func (*MockDriverMockRecorder) Rollback added in v1.2.7

func (mr *MockDriverMockRecorder) Rollback() *gomock.Call

Rollback indicates an expected call of Rollback.

func (*MockDriverMockRecorder) SelectContext added in v1.2.7

func (mr *MockDriverMockRecorder) SelectContext(ctx, dbShardID, dest, query interface{}, args ...interface{}) *gomock.Call

SelectContext indicates an expected call of SelectContext.

func (*MockDriverMockRecorder) SelectForSchemaQuery added in v1.2.7

func (mr *MockDriverMockRecorder) SelectForSchemaQuery(dbShardID, dest, query interface{}, args ...interface{}) *gomock.Call

SelectForSchemaQuery indicates an expected call of SelectForSchemaQuery.

type MockcommonOfDbAndTx added in v1.2.7

type MockcommonOfDbAndTx struct {
	// contains filtered or unexported fields
}

MockcommonOfDbAndTx is a mock of commonOfDbAndTx interface.

func NewMockcommonOfDbAndTx added in v1.2.7

func NewMockcommonOfDbAndTx(ctrl *gomock.Controller) *MockcommonOfDbAndTx

NewMockcommonOfDbAndTx creates a new mock instance.

func (*MockcommonOfDbAndTx) EXPECT added in v1.2.7

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockcommonOfDbAndTx) ExecContext added in v1.2.7

func (m *MockcommonOfDbAndTx) ExecContext(ctx context.Context, dbShardID int, query string, args ...interface{}) (sql.Result, error)

ExecContext mocks base method.

func (*MockcommonOfDbAndTx) GetContext added in v1.2.7

func (m *MockcommonOfDbAndTx) GetContext(ctx context.Context, dbShardID int, dest interface{}, query string, args ...interface{}) error

GetContext mocks base method.

func (*MockcommonOfDbAndTx) NamedExecContext added in v1.2.7

func (m *MockcommonOfDbAndTx) NamedExecContext(ctx context.Context, dbShardID int, query string, arg interface{}) (sql.Result, error)

NamedExecContext mocks base method.

func (*MockcommonOfDbAndTx) SelectContext added in v1.2.7

func (m *MockcommonOfDbAndTx) SelectContext(ctx context.Context, dbShardID int, dest interface{}, query string, args ...interface{}) error

SelectContext mocks base method.

type MockcommonOfDbAndTxMockRecorder added in v1.2.7

type MockcommonOfDbAndTxMockRecorder struct {
	// contains filtered or unexported fields
}

MockcommonOfDbAndTxMockRecorder is the mock recorder for MockcommonOfDbAndTx.

func (*MockcommonOfDbAndTxMockRecorder) ExecContext added in v1.2.7

func (mr *MockcommonOfDbAndTxMockRecorder) ExecContext(ctx, dbShardID, query interface{}, args ...interface{}) *gomock.Call

ExecContext indicates an expected call of ExecContext.

func (*MockcommonOfDbAndTxMockRecorder) GetContext added in v1.2.7

func (mr *MockcommonOfDbAndTxMockRecorder) GetContext(ctx, dbShardID, dest, query interface{}, args ...interface{}) *gomock.Call

GetContext indicates an expected call of GetContext.

func (*MockcommonOfDbAndTxMockRecorder) NamedExecContext added in v1.2.7

func (mr *MockcommonOfDbAndTxMockRecorder) NamedExecContext(ctx, dbShardID, query, arg interface{}) *gomock.Call

NamedExecContext indicates an expected call of NamedExecContext.

func (*MockcommonOfDbAndTxMockRecorder) SelectContext added in v1.2.7

func (mr *MockcommonOfDbAndTxMockRecorder) SelectContext(ctx, dbShardID, dest, query interface{}, args ...interface{}) *gomock.Call

SelectContext indicates an expected call of SelectContext.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL