base

package
v1.19.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2023 License: MIT Imports: 29 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DropTableColumns

func DropTableColumns(sess *xorm.Session, tableName string, columnNames ...string) (err error)

WARNING: YOU MUST COMMIT THE SESSION AT THE END

func HashToken

func HashToken(token, salt string) string

func MainTest

func MainTest(m *testing.M)

func ModifyColumn

func ModifyColumn(x *xorm.Engine, tableName string, col *schemas.Column) error

ModifyColumn will modify column's type or other property. SQLITE is not supported

func NewTestLogger

func NewTestLogger() log.LoggerProvider

NewTestLogger creates a TestLogger as a log.LoggerProvider

func PrepareTestEnv

func PrepareTestEnv(t *testing.T, skip int, syncModels ...interface{}) (*xorm.Engine, func())

PrepareTestEnv prepares the test environment and reset the database. The skip parameter should usually be 0. Provide models to be sync'd with the database - in particular any models you expect fixtures to be loaded from.

fixtures in `models/migrations/fixtures/<TestName>` will be loaded automatically

func PrintCurrentTest

func PrintCurrentTest(t testing.TB, skip ...int) func()

PrintCurrentTest prints the current test to os.Stdout

func Printf

func Printf(format string, args ...interface{})

Printf takes a format and args and prints the string to os.Stdout

func RecreateTable

func RecreateTable(sess *xorm.Session, bean interface{}) error

RecreateTable will recreate the table using the newly provided bean definition and move all data to that new table WARNING: YOU MUST PROVIDE THE FULL BEAN DEFINITION WARNING: YOU MUST COMMIT THE SESSION AT THE END

func RecreateTables

func RecreateTables(beans ...interface{}) func(*xorm.Engine) error

RecreateTables will recreate the tables for the provided beans using the newly provided bean definition and move all data to that new table WARNING: YOU MUST PROVIDE THE FULL BEAN DEFINITION

Types

type TestLogger

type TestLogger struct {
	log.WriterLogger
}

TestLogger is a logger which will write to the testing log

func (*TestLogger) Content

func (log *TestLogger) Content() (string, error)

Content returns the content accumulated in the content provider

func (*TestLogger) Flush

func (log *TestLogger) Flush()

Flush when log should be flushed

func (*TestLogger) GetName

func (log *TestLogger) GetName() string

GetName returns the default name for this implementation

func (*TestLogger) Init

func (log *TestLogger) Init(config string) error

Init inits connection writer with json config. json config only need key "level".

func (*TestLogger) ReleaseReopen

func (log *TestLogger) ReleaseReopen() error

ReleaseReopen does nothing

Jump to

Keyboard shortcuts

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