mock

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Anything is used in Diff and Assert when the argument being tested
	// shouldn't be taken into consideration.
	Anything = mock.Anything
)

Variables

View Source
var (
	// AnythingOfType returns an AnythingOfTypeArgument object containing the
	// name of the type to check for.
	AnythingOfType = mock.AnythingOfType

	// IsType returns an IsTypeArgument object containing the type to check for.
	// You can provide a zero-value of the type to check.  This is an alternative
	// to AnythingOfType.
	IsType = mock.IsType
)

Functions

This section is empty.

Types

type AnythingOfTypeArgument

type AnythingOfTypeArgument = mock.AnythingOfTypeArgument

AnythingOfTypeArgument is a string that contains the type of an argument for use when type checking.

type DB

type DB struct {
	mock.Mock
}

DB is an autogenerated mock type for the DBer type

func NewDB

func NewDB() (func(name string) record.DBer, *DB)

NewDB initializes a test DB that is useful for testing purpose.

func (*DB) Begin

func (_m *DB) Begin() (record.Txer, error)

Begin provides a mock function with given fields:

func (*DB) BeginContext

func (_m *DB) BeginContext(ctx context.Context, opts *sql.TxOptions) (record.Txer, error)

BeginContext provides a mock function with given fields: ctx, opts

func (*DB) Close

func (_m *DB) Close() error

Close provides a mock function with given fields:

func (*DB) Config

func (_m *DB) Config() *record.Config

Config provides a mock function with given fields:

func (*DB) Conn

func (_m *DB) Conn(ctx context.Context) (*sql.Conn, error)

Conn provides a mock function with given fields: ctx

func (*DB) Connect

func (_m *DB) Connect() error

Connect provides a mock function with given fields:

func (*DB) ConnectDefaultDB

func (_m *DB) ConnectDefaultDB() error

ConnectDefaultDB provides a mock function with given fields:

func (*DB) CreateDB

func (_m *DB) CreateDB(database string) error

CreateDB provides a mock function with given fields: database

func (*DB) Driver

func (_m *DB) Driver() driver.Driver

Driver provides a mock function with given fields:

func (*DB) DriverName

func (_m *DB) DriverName() string

DriverName provides a mock function with given fields:

func (*DB) DropDB

func (_m *DB) DropDB(database string) error

DropDB provides a mock function with given fields: database

func (*DB) DumpSchema

func (_m *DB) DumpSchema(database string) error

DumpSchema provides a mock function with given fields: database

func (*DB) Exec

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

Exec provides a mock function with given fields: query, args

func (*DB) ExecContext

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

ExecContext provides a mock function with given fields: ctx, query, args

func (*DB) GenerateMigration

func (_m *DB) GenerateMigration(name string, target string, tx bool) error

GenerateMigration provides a mock function with given fields: name, target, tx

func (*DB) Get

func (_m *DB) Get(dest interface{}, query string, args ...interface{}) error

Get provides a mock function with given fields: dest, query, args

func (*DB) GetContext

func (_m *DB) GetContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error

GetContext provides a mock function with given fields: ctx, dest, query, args

func (*DB) Migrate

func (_m *DB) Migrate() error

Migrate provides a mock function with given fields:

func (*DB) MigrateStatus

func (_m *DB) MigrateStatus() ([][]string, error)

MigrateStatus provides a mock function with given fields:

func (*DB) NamedExec

func (_m *DB) NamedExec(query string, arg interface{}) (sql.Result, error)

NamedExec provides a mock function with given fields: query, arg

func (*DB) NamedExecContext

func (_m *DB) NamedExecContext(ctx context.Context, query string, arg interface{}) (sql.Result, error)

NamedExecContext provides a mock function with given fields: ctx, query, arg

func (*DB) NamedQuery

func (_m *DB) NamedQuery(query string, arg interface{}) (*record.Rows, error)

NamedQuery provides a mock function with given fields: query, arg

func (*DB) NamedQueryContext

func (_m *DB) NamedQueryContext(ctx context.Context, query string, arg interface{}) (*record.Rows, error)

NamedQueryContext provides a mock function with given fields: ctx, query, arg

func (*DB) Ping

func (_m *DB) Ping() error

Ping provides a mock function with given fields:

func (*DB) PingContext

func (_m *DB) PingContext(ctx context.Context) error

PingContext provides a mock function with given fields: ctx

func (*DB) Prepare

func (_m *DB) Prepare(query string) (*record.Stmt, error)

Prepare provides a mock function with given fields: query

func (*DB) PrepareContext

func (_m *DB) PrepareContext(ctx context.Context, query string) (*record.Stmt, error)

PrepareContext provides a mock function with given fields: ctx, query

func (*DB) PrepareNamed

func (_m *DB) PrepareNamed(query string) (*record.NamedStmt, error)

PrepareNamed provides a mock function with given fields: query

func (*DB) PrepareNamedContext

func (_m *DB) PrepareNamedContext(ctx context.Context, query string) (*record.NamedStmt, error)

PrepareNamedContext provides a mock function with given fields: ctx, query

func (*DB) Query

func (_m *DB) Query(query string, args ...interface{}) (*record.Rows, error)

Query provides a mock function with given fields: query, args

func (*DB) QueryContext

func (_m *DB) QueryContext(ctx context.Context, query string, args ...interface{}) (*record.Rows, error)

QueryContext provides a mock function with given fields: ctx, query, args

func (*DB) QueryRow

func (_m *DB) QueryRow(query string, args ...interface{}) *record.Row

QueryRow provides a mock function with given fields: query, args

func (*DB) QueryRowContext

func (_m *DB) QueryRowContext(ctx context.Context, query string, args ...interface{}) *record.Row

QueryRowContext provides a mock function with given fields: ctx, query, args

func (*DB) Rebind

func (_m *DB) Rebind(query string) string

Rebind provides a mock function with given fields: query

func (*DB) RegisterMigration

func (_m *DB) RegisterMigration(up func(record.DBer) error, down func(record.DBer) error, args ...string) error

RegisterMigration provides a mock function with given fields: up, down, args

func (*DB) RegisterMigrationTx

func (_m *DB) RegisterMigrationTx(upTx func(record.Txer) error, downTx func(record.Txer) error, args ...string) error

RegisterMigrationTx provides a mock function with given fields: upTx, downTx, args

func (*DB) RegisterSeedTx

func (_m *DB) RegisterSeedTx(seed func(record.Txer) error)

RegisterSeedTx provides a mock function with given fields: seed

func (*DB) Rollback

func (_m *DB) Rollback() error

Rollback provides a mock function with given fields:

func (*DB) Schema

func (_m *DB) Schema() string

Schema provides a mock function with given fields:

func (*DB) Seed

func (_m *DB) Seed() error

Seed provides a mock function with given fields:

func (*DB) Select

func (_m *DB) Select(dest interface{}, query string, args ...interface{}) error

Select provides a mock function with given fields: dest, query, args

func (*DB) SelectContext

func (_m *DB) SelectContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error

SelectContext provides a mock function with given fields: ctx, dest, query, args

func (*DB) SetConnMaxLifetime

func (_m *DB) SetConnMaxLifetime(d time.Duration)

SetConnMaxLifetime provides a mock function with given fields: d

func (*DB) SetMaxIdleConns

func (_m *DB) SetMaxIdleConns(n int)

SetMaxIdleConns provides a mock function with given fields: n

func (*DB) SetMaxOpenConns

func (_m *DB) SetMaxOpenConns(n int)

SetMaxOpenConns provides a mock function with given fields: n

func (*DB) SetSchema

func (_m *DB) SetSchema(schema string)

SetSchema provides a mock function with given fields: schema

func (*DB) Stats

func (_m *DB) Stats() sql.DBStats

Stats provides a mock function with given fields:

type IsTypeArgument

type IsTypeArgument = mock.IsTypeArgument

IsTypeArgument is a struct that contains the type of an argument for use when type checking. This is an alternative to AnythingOfType.

type Mock

type Mock struct {
	mock.Mock
}

Mock is the workhorse used to track activity on another object.

type Model

type Model struct {
	mock.Mock
}

Model is an autogenerated mock type for the Modeler type

func NewModel

func NewModel(mockedDest interface{}) (func(dest interface{}, opts ...record.ModelOption) record.Modeler, *Model)

NewModel initializes a test model that is useful for testing purpose.

func (*Model) All

func (_m *Model) All() record.Modeler

All provides a mock function with given fields:

func (*Model) AttrByDBColumn

func (_m *Model) AttrByDBColumn(dbColumn string) *record.ModelAttr

AttrByDBColumn provides a mock function with given fields: dbColumn

func (*Model) Begin

func (_m *Model) Begin() error

Begin provides a mock function with given fields:

func (*Model) BeginContext

func (_m *Model) BeginContext(ctx context.Context, opts *sql.TxOptions) error

BeginContext provides a mock function with given fields: ctx, opts

func (*Model) Commit

func (_m *Model) Commit() []error

Commit provides a mock function with given fields:

func (*Model) Count

func (_m *Model) Count() record.Modeler

Count provides a mock function with given fields:

func (*Model) Create

func (_m *Model) Create() record.Modeler

Create provides a mock function with given fields:

func (*Model) Delete

func (_m *Model) Delete() record.Modeler

Delete provides a mock function with given fields:

func (*Model) DeleteAll

func (_m *Model) DeleteAll() record.Modeler

DeleteAll provides a mock function with given fields:

func (*Model) Exec

func (_m *Model) Exec(opts ...record.ExecOption) (int64, []error)

Exec provides a mock function with given fields: opts

func (*Model) Find

func (_m *Model) Find() record.Modeler

Find provides a mock function with given fields:

func (*Model) Group

func (_m *Model) Group(group string) record.Modeler

Group provides a mock function with given fields: group

func (*Model) Having

func (_m *Model) Having(having string, args ...interface{}) record.Modeler

Having provides a mock function with given fields: having, args

func (*Model) Join

func (_m *Model) Join(join string, args ...interface{}) record.Modeler

Join provides a mock function with given fields: join, args

func (*Model) Limit

func (_m *Model) Limit(limit int) record.Modeler

Limit provides a mock function with given fields: limit

func (*Model) Offset

func (_m *Model) Offset(offset int) record.Modeler

Offset provides a mock function with given fields: offset

func (*Model) Order

func (_m *Model) Order(order string) record.Modeler

Order provides a mock function with given fields: order

func (*Model) PrimaryKeys

func (_m *Model) PrimaryKeys() []string

PrimaryKeys provides a mock function with given fields:

func (*Model) Rollback

func (_m *Model) Rollback() []error

Rollback provides a mock function with given fields:

func (*Model) SQL

func (_m *Model) SQL() string

SQL provides a mock function with given fields:

func (*Model) Scan

func (_m *Model) Scan(dest interface{}) record.Modeler

Scan provides a mock function with given fields: dest

func (*Model) Select

func (_m *Model) Select(columns string) record.Modeler

Select provides a mock function with given fields: columns

func (*Model) Tx

func (_m *Model) Tx() record.Txer

Tx provides a mock function with given fields:

func (*Model) Update

func (_m *Model) Update() record.Modeler

Update provides a mock function with given fields:

func (*Model) UpdateAll

func (_m *Model) UpdateAll(set string, args ...interface{}) record.Modeler

UpdateAll provides a mock function with given fields: set, args

func (*Model) Where

func (_m *Model) Where(condition string, args ...interface{}) record.Modeler

Where provides a mock function with given fields: condition, args

type Stmt

type Stmt struct {
	mock.Mock
}

Stmt is an autogenerated mock type for the Stmter type

func (*Stmt) Exec

func (_m *Stmt) Exec(args ...interface{}) (sql.Result, error)

Exec provides a mock function with given fields: args

func (*Stmt) ExecContext

func (_m *Stmt) ExecContext(ctx context.Context, args ...interface{}) (sql.Result, error)

ExecContext provides a mock function with given fields: ctx, args

func (*Stmt) Query

func (_m *Stmt) Query(args ...interface{}) (*record.Rows, error)

Query provides a mock function with given fields: args

func (*Stmt) QueryContext

func (_m *Stmt) QueryContext(ctx context.Context, args ...interface{}) (*record.Rows, error)

QueryContext provides a mock function with given fields: ctx, args

func (*Stmt) QueryRow

func (_m *Stmt) QueryRow(args ...interface{}) *record.Row

QueryRow provides a mock function with given fields: args

func (*Stmt) QueryRowContext

func (_m *Stmt) QueryRowContext(ctx context.Context, args ...interface{}) *record.Row

QueryRowContext provides a mock function with given fields: ctx, args

type Tx

type Tx struct {
	mock.Mock
}

Tx is an autogenerated mock type for the Txer type

func (*Tx) Commit

func (_m *Tx) Commit() error

Commit provides a mock function with given fields:

func (*Tx) Exec

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

Exec provides a mock function with given fields: query, args

func (*Tx) ExecContext

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

ExecContext provides a mock function with given fields: ctx, query, args

func (*Tx) Get

func (_m *Tx) Get(dest interface{}, query string, args ...interface{}) error

Get provides a mock function with given fields: dest, query, args

func (*Tx) GetContext

func (_m *Tx) GetContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error

GetContext provides a mock function with given fields: ctx, dest, query, args

func (*Tx) NamedExec

func (_m *Tx) NamedExec(query string, arg interface{}) (sql.Result, error)

NamedExec provides a mock function with given fields: query, arg

func (*Tx) NamedExecContext

func (_m *Tx) NamedExecContext(ctx context.Context, query string, arg interface{}) (sql.Result, error)

NamedExecContext provides a mock function with given fields: ctx, query, arg

func (*Tx) NamedQuery

func (_m *Tx) NamedQuery(query string, arg interface{}) (*record.Rows, error)

NamedQuery provides a mock function with given fields: query, arg

func (*Tx) NamedQueryContext

func (_m *Tx) NamedQueryContext(ctx context.Context, query string, arg interface{}) (*record.Rows, error)

NamedQueryContext provides a mock function with given fields: ctx, query, arg

func (*Tx) Prepare

func (_m *Tx) Prepare(query string) (*record.Stmt, error)

Prepare provides a mock function with given fields: query

func (*Tx) PrepareContext

func (_m *Tx) PrepareContext(ctx context.Context, query string) (*record.Stmt, error)

PrepareContext provides a mock function with given fields: ctx, query

func (*Tx) PrepareNamed

func (_m *Tx) PrepareNamed(query string) (*record.NamedStmt, error)

PrepareNamed provides a mock function with given fields: query

func (*Tx) PrepareNamedContext

func (_m *Tx) PrepareNamedContext(ctx context.Context, query string) (*record.NamedStmt, error)

PrepareNamedContext provides a mock function with given fields: ctx, query

func (*Tx) Query

func (_m *Tx) Query(query string, args ...interface{}) (*record.Rows, error)

Query provides a mock function with given fields: query, args

func (*Tx) QueryContext

func (_m *Tx) QueryContext(ctx context.Context, query string, args ...interface{}) (*record.Rows, error)

QueryContext provides a mock function with given fields: ctx, query, args

func (*Tx) QueryRow

func (_m *Tx) QueryRow(query string, args ...interface{}) *record.Row

QueryRow provides a mock function with given fields: query, args

func (*Tx) QueryRowContext

func (_m *Tx) QueryRowContext(ctx context.Context, query string, args ...interface{}) *record.Row

QueryRowContext provides a mock function with given fields: ctx, query, args

func (*Tx) Rollback

func (_m *Tx) Rollback() error

Rollback provides a mock function with given fields:

func (*Tx) Select

func (_m *Tx) Select(dest interface{}, query string, args ...interface{}) error

Select provides a mock function with given fields: dest, query, args

func (*Tx) SelectContext

func (_m *Tx) SelectContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error

SelectContext provides a mock function with given fields: ctx, dest, query, args

func (*Tx) Stmt

func (_m *Tx) Stmt(stmt *record.Stmt) *record.Stmt

Stmt provides a mock function with given fields: stmt

func (*Tx) StmtContext

func (_m *Tx) StmtContext(ctx context.Context, stmt *record.Stmt) *record.Stmt

StmtContext provides a mock function with given fields: ctx, stmt

Jump to

Keyboard shortcuts

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