xorm

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DATABASE_DIR   = "database/"
	DEFAULTDB_NAME = "default"
)

default constant

Variables

View Source
var (
	// DBCONFIG_FILE config file path
	DBCONFIG_FILE = faygo.ConfigDir() + "xorm.ini"
)

Functions

func Callback

func Callback(fn func(*xorm.Session) error, session ...*xorm.Session) error

Callback uses the `default` database for non-transactional operations.

func CallbackByName

func CallbackByName(dbName string, fn func(*xorm.Session) error, session ...*xorm.Session) error

CallbackByName uses the specified database for non-transactional operations.

func DB

func DB(name ...string) (*xorm.Engine, bool)

DB is similar to MustDB, but safe.

func List

func List() map[string]*xorm.Engine

List gets the list of database engines

func MustDB

func MustDB(name ...string) *xorm.Engine

MustDB gets the specified database engine, or the default DB if no name is specified.

func TransactCallback

func TransactCallback(fn func(*xorm.Session) error, session ...*xorm.Session) (err error)

TransactCallback uses the default database for transactional operations.

func TransactCallbackByName

func TransactCallbackByName(dbName string, fn func(*xorm.Session) error, session ...*xorm.Session) (err error)

TransactCallbackByName uses the `specified` database for transactional operations.

Types

type DBConfig

type DBConfig struct {
	Name         string `ini:"-"`
	Enable       bool   `ini:"enable" comment:"Enable the config section"`
	Driver       string `ini:"driver" comment:"mssql | odbc(mssql) | mysql | mymysql | postgres | sqlite3 | oci8 | goracle"`
	Connstring   string `ini:"connstring" comment:"Connect String"`
	MaxOpenConns int    `ini:"max_open_conns"`
	MaxIdleConns int    `ini:"max_idle_conns"`
	ShowSql      bool   `ini:"show_sql" comment:"print sql"`
	TableFix     string `ini:"table_fix" comment:"the table namespace is located in the prefix or suffix: prefix | suffix"`
	TableSpace   string `ini:"table_space" comment:"table namespace"`
	TableSnake   bool   `ini:"table_snake" comment:"the table name uses the snake style or remains unchanged"`
	ColumnFix    string `ini:"column_fix" comment:"column namespace is located in the prefix or suffix: prefix | suffix"`
	ColumnSpace  string `ini:"column_space" comment:"column namespace"`
	ColumnSnake  bool   `ini:"column_snake" comment:"the column name uses the snake style or remains unchanged"`
	DisableCache bool   `ini:"disable_cache"`
	ShowExecTime bool   `ini:"show_exec_time" comment:"print exec time"`
}

DBConfig is database connection config

func Config

func Config(name ...string) (DBConfig, bool)

Config is similar to MustConfig, but safe.

func MustConfig

func MustConfig(name ...string) DBConfig

MustConfig gets the configuration information for the specified database, or returns the default if no name is specified.

type DBService

type DBService struct {
	Default *xorm.Engine            // the default database engine
	List    map[string]*xorm.Engine // database engine list
}

DBService is a database engine object.

type ILogger

type ILogger struct {
	// contains filtered or unexported fields
}

ILogger logger

func (*ILogger) Debug

func (i *ILogger) Debug(v ...interface{})

Debug DEBUG level log

func (*ILogger) Debugf

func (i *ILogger) Debugf(format string, v ...interface{})

Debug DEBUG level log with format

func (*ILogger) Error

func (i *ILogger) Error(v ...interface{})

Debug ERROR level log

func (*ILogger) Errorf

func (i *ILogger) Errorf(format string, v ...interface{})

Debug ERROR level log with format

func (*ILogger) Info

func (i *ILogger) Info(v ...interface{})

Debug INFO level log

func (*ILogger) Infof

func (i *ILogger) Infof(format string, v ...interface{})

Debug INFO level log with format

func (*ILogger) IsShowSQL

func (i *ILogger) IsShowSQL() bool

IsShowSQL returns if it wills show SQL

func (*ILogger) Level

func (i *ILogger) Level() core.LogLevel

Level returns log level

func (*ILogger) SetLevel

func (i *ILogger) SetLevel(l core.LogLevel)

SetLevel sets log level

func (*ILogger) ShowSQL

func (i *ILogger) ShowSQL(show ...bool)

func (*ILogger) Warn

func (i *ILogger) Warn(v ...interface{})

Debug WARN level log

func (*ILogger) Warnf

func (i *ILogger) Warnf(format string, v ...interface{})

Debug WARN level log with format

type Table

type Table interface {
	TableName() string
}

Table returns table name

Jump to

Keyboard shortcuts

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