Documentation ¶
Overview ¶
Package mock is a package for mocking MySQL.
Index ¶
- type DB
- func (db *DB) AssertAllTxCommitted(t *testing.T)
- func (db *DB) AssertAllTxCommittedOrRolledBack(t *testing.T)
- func (db *DB) AssertAllTxRolledBack(t *testing.T)
- func (db *DB) AssertAnyTxNotActive(t *testing.T)
- func (db *DB) AssertAnyTxNotBegin(t *testing.T)
- func (db *DB) BeginReadOnlyTx(_ context.Context) (repository.Tx, error)
- func (db *DB) BeginTx(_ context.Context, opts *sql.TxOptions) (repository.Tx, error)
- func (db *DB) Close() error
- func (db *DB) ExecContext(_ context.Context, _ string, _ ...interface{}) (sql.Result, error)
- func (db *DB) PrepareContext(_ context.Context, _ string) (*sql.Stmt, error)
- func (db *DB) QueryContext(_ context.Context, _ string, _ ...interface{}) (*sql.Rows, error)
- func (db *DB) QueryRowContext(_ context.Context, _ string, _ ...interface{}) *sql.Row
- func (db *DB) Reset()
- type Result
- type Tx
- func (tx *Tx) Commit() error
- func (tx *Tx) ExecContext(_ context.Context, _ string, _ ...interface{}) (sql.Result, error)
- func (tx *Tx) PrepareContext(_ context.Context, _ string) (*sql.Stmt, error)
- func (tx *Tx) QueryContext(_ context.Context, _ string, _ ...interface{}) (*sql.Rows, error)
- func (tx *Tx) QueryRowContext(_ context.Context, _ string, _ ...interface{}) *sql.Row
- func (tx *Tx) Rollback() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB is a struct that contains the settings for the MySQL database.
func (*DB) AssertAllTxCommitted ¶
AssertAllTxCommitted asserts that all transactions are committed.
func (*DB) AssertAllTxCommittedOrRolledBack ¶
AssertAllTxCommittedOrRolledBack asserts that all transactions are committed or rolled back.
func (*DB) AssertAllTxRolledBack ¶
AssertAllTxRolledBack asserts that all transactions are rolled back.
func (*DB) AssertAnyTxNotActive ¶
AssertAnyTxNotActive asserts that any transaction is not active.
func (*DB) AssertAnyTxNotBegin ¶
AssertAnyTxNotBegin asserts that any transaction is not begin.
func (*DB) BeginReadOnlyTx ¶
BeginReadOnlyTx begins a read-only transaction.
func (*DB) ExecContext ¶
ExecContext executes a query that doesn't return rows.
func (*DB) PrepareContext ¶
PrepareContext prepares a query that returns rows.
func (*DB) QueryContext ¶
QueryContext executes a query that returns rows.
func (*DB) QueryRowContext ¶
QueryRowContext executes a query that is expected to return at most one row.
type Result ¶
type Result struct{}
Result is a struct that contains the result of a query.
func (*Result) LastInsertId ¶
LastInsertId returns the integer generated by the database in response to a command.
func (*Result) RowsAffected ¶
RowsAffected returns the number of rows affected by an update, insert, or delete.
type Tx ¶
type Tx struct {
// contains filtered or unexported fields
}
Tx is a struct that contains the settings for the transaction.
func (*Tx) ExecContext ¶
ExecContext executes a query that doesn't return rows.
func (*Tx) PrepareContext ¶
PrepareContext prepares a query that returns rows.
func (*Tx) QueryContext ¶
QueryContext executes a query that returns rows.
func (*Tx) QueryRowContext ¶
QueryRowContext executes a query that is expected to return at most one row.