Documentation
¶
Index ¶
- Constants
- Variables
- func Callback(fn func(*xorm.Session) error, session ...*xorm.Session) error
- func CallbackByName(dbName string, fn func(*xorm.Session) error, session ...*xorm.Session) error
- func DB(name ...string) (*xorm.Engine, bool)
- func List() map[string]*xorm.Engine
- func MustDB(name ...string) *xorm.Engine
- func TransactCallback(fn func(*xorm.Session) error, session ...*xorm.Session) (err error)
- func TransactCallbackByName(dbName string, fn func(*xorm.Session) error, session ...*xorm.Session) (err error)
- type DBConfig
- type DBService
- type ILogger
- func (i *ILogger) Debug(v ...interface{})
- func (i *ILogger) Debugf(format string, v ...interface{})
- func (i *ILogger) Error(v ...interface{})
- func (i *ILogger) Errorf(format string, v ...interface{})
- func (i *ILogger) Info(v ...interface{})
- func (i *ILogger) Infof(format string, v ...interface{})
- func (i *ILogger) IsShowSQL() bool
- func (i *ILogger) Level() core.LogLevel
- func (i *ILogger) SetLevel(l core.LogLevel)
- func (i *ILogger) ShowSQL(show ...bool)
- func (i *ILogger) Warn(v ...interface{})
- func (i *ILogger) Warnf(format string, v ...interface{})
- type Table
Constants ¶
View Source
const ( DATABASE_DIR = "database/" DEFAULTDB_NAME = "default" )
default constant
Variables ¶
Functions ¶
func Callback ¶
Callback uses the `default` database for non-transactional operations.
func CallbackByName ¶
CallbackByName uses the specified database for non-transactional operations.
func MustDB ¶
MustDB gets the specified database engine, or the default DB if no name is specified.
func TransactCallback ¶
TransactCallback uses the default 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 ¶
Config is similar to MustConfig, but safe.
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) Debugf ¶
Debugf DEBUG level log with format
func (*ILogger) Errorf ¶
Errorf ERROR level log with format
func (*ILogger) Infof ¶
Infof INFO level log with format
func (*ILogger) IsShowSQL ¶
IsShowSQL returns if it wills show SQL
Source Files
¶
- config.go
- helper.go
- logger.go
- service.go
Click to show internal directories.
Click to hide internal directories.