Documentation ¶
Index ¶
- func AssertCount(t *testing.T, table string, where builder.Cond, count int64)
- func AssertExists(t *testing.T, table string, values map[string]interface{}, custom bool)
- func AssertMissing(t *testing.T, table string, values map[string]interface{})
- func CreateDBEngine() (engine *xorm.Engine, err error)
- func CreateTestEngine() (engine *xorm.Engine, err error)
- func Dump() (data map[string][]byte, err error)
- func GetDialect() string
- func ILIKE(column, search string) builder.Cond
- func InitFixtures(tablenames ...string) (err error)
- func InitTestFixtures(tablenames ...string) (err error)
- func LoadAndAssertFixtures(t *testing.T)
- func LoadFixtures() error
- func NewSession() *xorm.Session
- func Restore(table string, contents []map[string]interface{}) (err error)
- func RestoreAndTruncate(table string, contents []map[string]interface{}) (err error)
- func Type() schemas.DBType
- func WipeEverything() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertCount ¶ added in v0.20.3
AssertCount checks if a number of entries exists in the database
func AssertExists ¶ added in v0.15.0
AssertExists checks and asserts the existence of certain entries in the db
func AssertMissing ¶ added in v0.15.0
AssertMissing checks and asserts the nonexiste nce of certain entries in the db
func CreateDBEngine ¶
CreateDBEngine initializes a db engine from the config
func CreateTestEngine ¶
CreateTestEngine creates an instance of the db engine which lives in memory
func GetDialect ¶ added in v0.24.0
func GetDialect() string
func ILIKE ¶ added in v0.18.0
ILIKE returns an ILIKE query on postgres and a LIKE query on all other platforms. Postgres' is case-sensitive by default. To work around this, we're using ILIKE as opposed to normal LIKE statements. ILIKE is preferred over LOWER(text) LIKE for performance reasons. See https://stackoverflow.com/q/7005302/10924593
func InitFixtures ¶
InitFixtures initialize test fixtures for a test database
func InitTestFixtures ¶
InitTestFixtures populates the db with all fixtures from the fixtures folder
func LoadAndAssertFixtures ¶
LoadAndAssertFixtures loads all fixtures defined before and asserts they are correctly loaded
func NewSession ¶ added in v0.16.0
NewSession creates a new xorm session
func RestoreAndTruncate ¶ added in v0.16.0
RestoreAndTruncate removes all content from the table before restoring it from the contents map
func WipeEverything ¶ added in v0.14.0
func WipeEverything() error
WipeEverything wipes all tables and their data. Use with caution...
Types ¶
This section is empty.