mocksql

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotMatchDestination defines an error for mismatching case
	ErrNotMatchDestination = errors.New("not matching destination to scan")
	// ErrNotReadableValue defines an error for the value is not addressable or interfaceable
	ErrNotReadableValue = errors.New("value not addressable or interfaceable")
	// ErrNotSettable defines an error for the variable is not settable
	ErrNotSettable = errors.New("passed in variable is not settable")
	// ErrUnsupportedValueType deinfes an error for unsupported unmarshal type
	ErrUnsupportedValueType = errors.New("unsupported unmarshal type")
)
View Source
var ErrNotFound = sql.ErrNoRows

ErrNotFound is the alias of sql.ErrNoRows

Functions

This section is empty.

Types

type MockConn

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

MockConn defines a mock connection instance for mysql

func NewMockConn

func NewMockConn(db *sql.DB) *MockConn

NewMockConn creates an instance for MockConn

func (*MockConn) Exec

func (conn *MockConn) Exec(query string, args ...interface{}) (sql.Result, error)

Exec executes sql and returns the result

func (*MockConn) ExecCtx added in v1.3.3

func (conn *MockConn) ExecCtx(_ context.Context, query string, args ...interface{}) (sql.Result, error)

ExecCtx executes sql and returns the result

func (*MockConn) Prepare

func (conn *MockConn) Prepare(query string) (sqlx.StmtSession, error)

Prepare executes sql by sql.DB

func (*MockConn) PrepareCtx added in v1.3.3

func (conn *MockConn) PrepareCtx(_ context.Context, query string) (sqlx.StmtSession, error)

PrepareCtx executes sql by sql.DB

func (*MockConn) QueryRow

func (conn *MockConn) QueryRow(v interface{}, q string, args ...interface{}) error

QueryRow executes sql and returns a query row

func (*MockConn) QueryRowCtx added in v1.3.3

func (conn *MockConn) QueryRowCtx(_ context.Context, v interface{}, query string, args ...interface{}) error

QueryRowCtx executes sql and returns a query row

func (*MockConn) QueryRowPartial

func (conn *MockConn) QueryRowPartial(v interface{}, q string, args ...interface{}) error

QueryRowPartial executes sql and returns a partial query row

func (*MockConn) QueryRowPartialCtx added in v1.3.3

func (conn *MockConn) QueryRowPartialCtx(_ context.Context, v interface{}, query string, args ...interface{}) error

QueryRowPartialCtx executes sql and returns a partial query row

func (*MockConn) QueryRows

func (conn *MockConn) QueryRows(v interface{}, q string, args ...interface{}) error

QueryRows executes sql and returns query rows

func (*MockConn) QueryRowsCtx added in v1.3.3

func (conn *MockConn) QueryRowsCtx(_ context.Context, v interface{}, query string, args ...interface{}) error

QueryRowsCtx executes sql and returns query rows

func (*MockConn) QueryRowsPartial

func (conn *MockConn) QueryRowsPartial(v interface{}, q string, args ...interface{}) error

QueryRowsPartial executes sql and returns partial query rows

func (*MockConn) QueryRowsPartialCtx added in v1.3.3

func (conn *MockConn) QueryRowsPartialCtx(_ context.Context, v interface{}, query string, args ...interface{}) error

QueryRowsPartialCtx executes sql and returns partial query rows

func (*MockConn) RawDB

func (conn *MockConn) RawDB() (*sql.DB, error)

RawDB returns the underlying sql.DB.

func (*MockConn) Transact

func (conn *MockConn) Transact(func(session sqlx.Session) error) error

Transact is the implemention of sqlx.SqlConn, nothing to do

func (*MockConn) TransactCtx added in v1.3.3

func (conn *MockConn) TransactCtx(ctx context.Context, fn func(context.Context, sqlx.Session) error) error

TransactCtx is the implemention of sqlx.SqlConn, nothing to do

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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