testutils

package
v0.0.0-...-f860bb7 Latest Latest
Warning

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

Go to latest
Published: May 29, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CatchDBExecPanic

func CatchDBExecPanic()

CatchDBExecPanic catch DBExec's panic. Usually it is called in a defer.

func Chain

func Chain(fn func(context.Context) error, mws ...MW) func(context.Context) error

Chain wraps fn with a stack of middlewares.

func DBExec

func DBExec(t *testing.T, conn *sql.Conn, query string, args ...interface{})

DBExec execute the query and panic if something error happened. Should use CatchDBExecPanic to catch the panic.

func GetPool

func GetPool() *dockertest.Pool

GetPool returns a global dockertest.Pool

func MysqlConn

func MysqlConn(ctx context.Context) *sql.Conn

MysqlConn returns the mysql connection stored in context if exists.

func WithMysqlConn

func WithMysqlConn(fn func(context.Context) error) func(context.Context) error

WithMysqlConn is a middelware to fn and add a usable mysql connection to the context.

Types

type MW

type MW func(func(context.Context) error) func(context.Context) error

MW is a middleware type

Jump to

Keyboard shortcuts

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