Documentation
¶
Index ¶
- Constants
- Variables
- func GetConnStr() string
- func GetConnection(userid string, ismasterdb bool) (db *xorm.Engine, err error)
- func GetDB() (db *xorm.Engine, err error)
- func GetEasyTraDb() (db *xorm.Engine, err error)
- func GetOcrDB() (db *xorm.Engine, err error)
- func GetSession(ismasterdb bool) (db *xorm.Session)
- func InitConnections()
Constants ¶
View Source
const CONF_CURRDB = "currdb"
View Source
const CONF_DBNAME = "database"
View Source
const CONF_DBPASSWORD = "password"
View Source
const CONF_DBPORT = "port"
View Source
const CONF_DBSERVER = "server"
View Source
const CONF_DBUSERNAME = "username"
View Source
const CONF_SEC_GLOBAL = "global"
View Source
const DBTYPE_MYSQL = "mysql"
View Source
const DBTYPE_OCR = "ocrdb"
View Source
const DBTYPE_SQLSERVER = "mssql"
Variables ¶
View Source
var DBType string
View Source
var EngineMap map[string]*xorm.Engine
采用单例
Functions ¶
func GetConnection ¶
获取数据库连接对象,主从方式获取,根据传递的userid 确定从数据库连接 Engine调用一个SQL都会创建新的Session,完毕又会关闭Session, 多个SQL语句场景,非常消耗性能 多个SQL语句场景,建议使用 GetSession 获取Session ,注意需要手动关闭 建议使用该方法关闭:defer session.Close()
func InitConnections ¶
func InitConnections()
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.