mock

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBHandler

type DBHandler struct {
	QueryContextFunc    func(ctx context.Context, query string, args ...interface{}) (*database.Rows, error)
	QueryRowContextFunc func(ctx context.Context, query string, args ...interface{}) *database.Row
	ExecContextFunc     func(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
	BeginTxFunc         func(ctx context.Context, opts *sql.TxOptions) (*database.Tx, error)
}

DBHandler is a mock implementation of the database.DBHandler interface.

func (*DBHandler) BeginTx

func (m *DBHandler) BeginTx(ctx context.Context, opts *sql.TxOptions) (*database.Tx, error)

func (*DBHandler) ExecContext

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

func (*DBHandler) QueryContext

func (m *DBHandler) QueryContext(ctx context.Context, query string, args ...interface{}) (*database.Rows, error)

func (*DBHandler) QueryRowContext

func (m *DBHandler) QueryRowContext(ctx context.Context, query string, args ...interface{}) *database.Row

type RowHandler

type RowHandler struct {
	NextFunc func() bool
	ErrFunc  func() error
	ScanFunc func(dest ...interface{}) error
}

RowHandler is a mock implementation of the database.RowHandler interface.

func (*RowHandler) Err

func (m *RowHandler) Err() error

func (*RowHandler) Next

func (m *RowHandler) Next() bool

func (*RowHandler) Scan

func (m *RowHandler) Scan(dest ...interface{}) error

type RowsHandler

type RowsHandler struct {
	CloseFunc func() error
	ErrFunc   func() error
	NextFunc  func() bool
	ScanFunc  func(dest ...interface{}) error
}

RowsHandler is a mock implementation of the database.RowsHandler interface.

func (*RowsHandler) Close

func (m *RowsHandler) Close() error

func (*RowsHandler) Err

func (m *RowsHandler) Err() error

func (*RowsHandler) Next

func (m *RowsHandler) Next() bool

func (*RowsHandler) Scan

func (m *RowsHandler) Scan(dest ...interface{}) error

type Transactor

type Transactor struct {
	BeginTxFunc func(ctx context.Context, opts *sql.TxOptions) (*database.Tx, error)
}

Tx is a mock implementation of the database.Tx interface.

func (*Transactor) BeginTx

func (m *Transactor) BeginTx(ctx context.Context, opts *sql.TxOptions) (*database.Tx, error)

type TxHandler

type TxHandler struct {
	DBHandler
	CommitFunc   func() error
	RollbackFunc func() error
}

TxHandler is a mock implementation of the database.TxHandler interface.

func (*TxHandler) Commit

func (m *TxHandler) Commit() error

func (*TxHandler) Rollback

func (m *TxHandler) Rollback() error

Jump to

Keyboard shortcuts

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