Documentation
¶
Index ¶
- Constants
- func DBOpen(t *testing.T, opts *DBOptions) (db sqlize.DB, err error)
- func Example()
- func LoggingDriver(driver string) string
- func MustDBOpen(t *testing.T, opts *DBOptions) sqlize.DB
- func RegisterLogging(name string, driver driver.Driver)
- func Test(ctx context.Context) *testing.T
- func Truncate(db sqlize.Querier, tables ...bsq.Tabler) error
- func WithTest(ctx context.Context, t *testing.T) context.Context
- type CRUDOperation
- type CRUDTest32
- type CRUDTest64
- type ChangeFunc
- type DBOptions
- type Logger
- func (l Logger) ConnBeginTx(ctx context.Context, conn driver.ConnBeginTx, opts driver.TxOptions) (driver.Tx, error)
- func (l Logger) ConnExecContext(ctx context.Context, conn driver.ExecerContext, query string, ...) (driver.Result, error)
- func (l Logger) ConnPrepareContext(ctx context.Context, conn driver.ConnPrepareContext, query string) (driver.Stmt, error)
- func (l Logger) ConnQueryContext(ctx context.Context, conn driver.QueryerContext, query string, ...) (driver.Rows, error)
- func (l Logger) StmtExecContext(ctx context.Context, conn driver.StmtExecContext, query string, ...) (driver.Result, error)
- func (l Logger) StmtQueryContext(ctx context.Context, conn driver.StmtQueryContext, query string, ...) (driver.Rows, error)
- func (l Logger) TxCommit(ctx context.Context, tx driver.Tx) error
- func (l Logger) TxRollback(ctx context.Context, tx driver.Tx) error
- type Queries
Constants ¶
View Source
const ( ENV_DBDRIVER = "SQLIZE_TSTDB_DRIVER" ENV_DBSOURCE = "SQLIZE_TSTDB_SOURCE" )
View Source
const OpsErrorFmt = "Expected operations %s, got %s"
Variables ¶
This section is empty.
Functions ¶
func Example ¶
func Example()
Types ¶
type CRUDOperation ¶
type CRUDOperation int
const ( CreateOp CRUDOperation = (1 << iota) ReadOp UpdateOp DeleteOp )
func (CRUDOperation) All ¶
func (ops CRUDOperation) All(test CRUDOperation) bool
func (CRUDOperation) Any ¶
func (ops CRUDOperation) Any(test CRUDOperation) bool
func (CRUDOperation) String ¶
func (ops CRUDOperation) String() string
type CRUDTest32 ¶
type CRUDTest32 struct {
// WriteObj is set by test code and then written to the DB
WriteObj sqlize.Entity32
// ReadObj is read from DB to be compared with the WriteObj
ReadObj sqlize.Entity32
// Chage is used to modify the WriteObj to check updates
Change ChangeFunc
// If Equal is not nil it is used to compare WriteObj and ReadObj. Otherwise
// the objects are compared with reflect.DeepEqual().
Equal func() bool
// The DAO object to handle the CRUD operations
Repo sqlize.Repo32
}
func (*CRUDTest32) Run ¶
func (ct *CRUDTest32) Run(t *testing.T, db sqlize.Querier, insert bool) (res CRUDOperation)
type CRUDTest64 ¶
type CRUDTest64 struct {
WriteObj sqlize.Entity64
ReadObj sqlize.Entity64
Change ChangeFunc
Equal func() bool
Repo sqlize.Repo64
}
func (*CRUDTest64) Run ¶
func (ct *CRUDTest64) Run(t *testing.T, db sqlize.Querier) (res CRUDOperation)
type ChangeFunc ¶
ChangeFunc is used in CRUDTests to modify the write object and see if the written change is successfully read back. Changing the write object will be repeated until the ChangeFunc retuns chainNext == nil. Otherwise chainNext will be passed to the next call of the ChangeFunc.
type Logger ¶ added in v0.2.0
type Logger struct {
sqlmw.NullInterceptor
}
func (Logger) ConnBeginTx ¶ added in v0.2.0
func (Logger) ConnExecContext ¶ added in v0.2.0
func (Logger) ConnPrepareContext ¶ added in v0.2.0
func (Logger) ConnQueryContext ¶ added in v0.2.0
func (Logger) StmtExecContext ¶ added in v0.2.0
func (Logger) StmtQueryContext ¶ added in v0.2.0
func (Logger) TxCommit ¶ added in v0.2.0
Source Files
¶
- crud.go
- testconn.go
- testlog.go
- testsq.go
Click to show internal directories.
Click to hide internal directories.