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 OpenArgs(opts *DBOptions) (driver, dataSource string)
- func RegisterLogging(name string, driver driver.Driver)
- func StdDBPtr(db sqlize.DB) *sql.DB
- 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 CRUDTest
- type ChangeFunc
- type DBOptions
- type Logger
- func (l Logger) ConnBeginTx(ctx context.Context, conn driver.ConnBeginTx, opts driver.TxOptions) (context.Context, 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) (context.Context, driver.Stmt, error)
- func (l Logger) ConnQueryContext(ctx context.Context, conn driver.QueryerContext, query string, ...) (context.Context, 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, ...) (context.Context, 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 CRUDOps = CreateOp | ReadOp | UpdateOp | DeleteOp
View Source
const OpsErrorFmt = "Expected operations %s, got %s"
Variables ¶
This section is empty.
Functions ¶
func LoggingDriver ¶ added in v0.2.0
func RegisterLogging ¶ added in v0.2.0
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 CRUDTest ¶ added in v0.3.0
type CRUDTest[E sqlize.Entity[ID], ID sqlize.EntityID] struct { // WriteObj is set by test code and then written to the DB WriteObj E // ReadObj is read from DB to be compared with the WriteObj ReadObj E // 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 Repo that handles the CRUD operations Repo sqlize.Repo[E, ID] }
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
Click to show internal directories.
Click to hide internal directories.