Documentation ¶
Index ¶
- Constants
- func DBOpen(t *testing.T, opts *DBOptions) (sqlize.DB, error)
- func Example()
- func MustDBOpen(t *testing.T, opts *DBOptions) sqlize.DB
- func Truncate(db sqlize.SQL, tables ...bsq.Tabler) error
- type CRUDOperation
- type CRUDTest32
- type CRUDTest64
- type ChangeFunc
- type DBOptions
- type LogTo
- 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 ¶
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.SQL, 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.SQL) (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.
Click to show internal directories.
Click to hide internal directories.