sqltest

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent interface {
	ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
	QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
}

Agent defines a common set of methods for executing stored procedures, statements or queries.

type Truncator

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

Truncator represents a common set of methods for truncating a database during testing.

func NewTruncator

func NewTruncator(agent Agent) *Truncator

NewTruncator sets up a new truncator.

func (*Truncator) MustTruncateAll

func (tr *Truncator) MustTruncateAll(t testing.TB)

MustTruncateAll will run TruncateAll and fail test if it can't.

func (*Truncator) MustTruncateTables

func (tr *Truncator) MustTruncateTables(t testing.TB)

MustTruncateTables will run TruncateTables and will fail test if it can't.

func (*Truncator) TruncateAll

func (tr *Truncator) TruncateAll(t testing.TB) error

TruncateAll will empty all tables in the database.

func (*Truncator) TruncateTables

func (tr *Truncator) TruncateTables(t testing.TB, tables ...string) error

TruncateTables removes all content in the given tables.

Jump to

Keyboard shortcuts

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