test

package
v0.56.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2020 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StubExecer

type StubExecer struct {
	N    int64
	Row  pgxapi.SqlRow
	Rows pgxapi.SqlRows
	Err  error
	Lgr  pgxapi.Logger
	Q    quote.Quoter
	User interface{}
}

StubExecer provides a non-functioning Execer for testing purposes.

func (StubExecer) BeginBatch

func (e StubExecer) BeginBatch() *pgx.Batch

BeginBatch is not implemented

func (StubExecer) Close

func (e StubExecer) Close() error

func (StubExecer) Commit

func (e StubExecer) Commit(_ context.Context) error

func (StubExecer) Dialect

func (e StubExecer) Dialect() dialect.Dialect

func (StubExecer) Exec added in v0.55.0

func (e StubExecer) Exec(ctx context.Context, query string, args ...interface{}) (int64, error)

func (StubExecer) Insert added in v0.55.0

func (e StubExecer) Insert(ctx context.Context, pk, query string, args ...interface{}) (int64, error)

func (StubExecer) IsTx

func (StubExecer) IsTx() bool

func (StubExecer) Logger

func (e StubExecer) Logger() pgxapi.Logger

func (StubExecer) Ping added in v0.55.0

func (e StubExecer) Ping(_ context.Context) error

func (StubExecer) Query added in v0.55.0

func (e StubExecer) Query(ctx context.Context, query string, args ...interface{}) (pgxapi.SqlRows, error)

func (StubExecer) QueryRow added in v0.55.0

func (e StubExecer) QueryRow(ctx context.Context, query string, args ...interface{}) pgxapi.SqlRow

func (StubExecer) Rollback

func (e StubExecer) Rollback(_ context.Context) error

func (StubExecer) SingleConn

func (e StubExecer) SingleConn(_ context.Context, fn func(ex pgxapi.Execer) error) error

func (StubExecer) Stats

func (e StubExecer) Stats() pgxapi.DBStats

func (StubExecer) Transact

func (e StubExecer) Transact(_ context.Context, txOptions *pgx.TxOptions, fn func(pgxapi.SqlTx) error) error

func (StubExecer) UserItem added in v0.53.0

func (e StubExecer) UserItem() interface{}

func (StubExecer) With added in v0.53.0

func (e StubExecer) With(userItem interface{}) pgxapi.SqlDB

type StubLogger

type StubLogger struct {
	Testing TestingLogger
	Logged  []string
}

StubLogger provides a testingadapter.TestingLogger that captures logged information and optionally plays it through a child logger too.

func (*StubLogger) Log

func (r *StubLogger) Log(_ context.Context, level pgx.LogLevel, msg string, data map[string]interface{})

type StubRow

type StubRow []interface{}

StubRow provides a non-functioning pgxapi.SqlRow for testing purposes.

func (StubRow) Scan

func (r StubRow) Scan(dest ...interface{}) error

type StubRows

type StubRows struct {
	I          int
	Rows       []StubRow
	Error      error
	Fields     []pgproto3.FieldDescription
	ValueSlice []interface{}
}

StubRow provides a non-functioning pgxapi.SqlRows for testing purposes.

func (*StubRows) Close

func (r *StubRows) Close()

func (*StubRows) Err

func (r *StubRows) Err() error

func (*StubRows) FieldDescriptions

func (r *StubRows) FieldDescriptions() []pgproto3.FieldDescription

func (*StubRows) Next

func (r *StubRows) Next() bool

func (*StubRows) Scan

func (r *StubRows) Scan(dest ...interface{}) error

func (*StubRows) Values

func (r *StubRows) Values() ([]interface{}, error)

type TestingLogger added in v0.54.0

type TestingLogger interface {
	Log(args ...interface{})
}

TestingLogger interface defines the subset of testing.TB methods used by this adapter.

Jump to

Keyboard shortcuts

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