Documentation
¶
Index ¶
- Constants
- 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 ( DBCONFIG_FILE = faygo.CONFIG_DIR + "xorm.ini" DATABASE_DIR = "database/" DEFAULTDB_NAME = "default" )
default constant
Variables ¶
This section is empty.
Functions ¶
func CallbackByName ¶
CallbackByName uses the specified database for non-transactional operations.
func TransactCallback ¶
TransactCallback uses the default database for transactional operations. note: if an error is returned, the rollback method should be invoked outside the function.
func TransactCallbackByName ¶
func TransactCallbackByName(dbName string, fn func(*xorm.Session) error, session ...*xorm.Session) (err error)
TransactCallbackByName uses the `specified` database for transactional operations. note: if an error is returned, the rollback method should be invoked outside the function.
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 MustConfig ¶
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
Click to show internal directories.
Click to hide internal directories.