db

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2024 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertCount added in v0.20.3

func AssertCount(t *testing.T, table string, where builder.Cond, count int64)

AssertCount checks if a number of entries exists in the database

func AssertExists added in v0.15.0

func AssertExists(t *testing.T, table string, values map[string]interface{}, custom bool)

AssertExists checks and asserts the existence of certain entries in the db

func AssertMissing added in v0.15.0

func AssertMissing(t *testing.T, table string, values map[string]interface{})

AssertMissing checks and asserts the nonexiste nce of certain entries in the db

func CreateDBEngine

func CreateDBEngine() (engine *xorm.Engine, err error)

CreateDBEngine initializes a db engine from the config

func CreateTestEngine

func CreateTestEngine() (engine *xorm.Engine, err error)

CreateTestEngine creates an instance of the db engine which lives in memory

func Dump added in v0.14.0

func Dump() (data map[string][]byte, err error)

Dump dumps all database tables

func ILIKE added in v0.18.0

func ILIKE(column, search string) builder.Cond

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

func InitFixtures(tablenames ...string) (err error)

InitFixtures initialize test fixtures for a test database

func InitTestFixtures

func InitTestFixtures(tablenames ...string) (err error)

InitTestFixtures populates the db with all fixtures from the fixtures folder

func LoadAndAssertFixtures

func LoadAndAssertFixtures(t *testing.T)

LoadAndAssertFixtures loads all fixtures defined before and asserts they are correctly loaded

func LoadFixtures

func LoadFixtures() error

LoadFixtures load fixtures for a test database

func NewSession added in v0.16.0

func NewSession() *xorm.Session

NewSession creates a new xorm session

func Restore added in v0.14.0

func Restore(table string, contents []map[string]interface{}) (err error)

Restore restores a table with all its entries

func RestoreAndTruncate added in v0.16.0

func RestoreAndTruncate(table string, contents []map[string]interface{}) (err error)

RestoreAndTruncate removes all content from the table before restoring it from the contents map

func Type added in v0.16.0

func Type() schemas.DBType

Type returns the db type of the currently configured db

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.

Jump to

Keyboard shortcuts

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