本文整理匯總了Golang中github.com/jmoiron/sqlx.DB.MapperFunc方法的典型用法代碼示例。如果您正苦於以下問題:Golang DB.MapperFunc方法的具體用法?Golang DB.MapperFunc怎麽用?Golang DB.MapperFunc使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/jmoiron/sqlx.DB
的用法示例。
在下文中一共展示了DB.MapperFunc方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: GetAgeModelData
// GetAgeModelData does the search and modifies the results struct pointer
// Not placed in the above function to allow this to be called by stand along apps like ocdBulk
func GetAgeModelData(db *sqlx.DB, sqlstring string, results **[]AgeModel) {
db.MapperFunc(strings.ToUpper)
err := db.Select(*results, sqlstring)
if err != nil {
log.Printf(`Error v2 with: %s`, err)
}
}
示例2: GetMasterStatus
func GetMasterStatus(db *sqlx.DB) (MasterStatus, error) {
db.MapperFunc(strings.Title)
ms := MasterStatus{}
err := db.Get(&ms, "SHOW MASTER STATUS")
return ms, err
}
示例3: GetAllSlavesStatus
func GetAllSlavesStatus(db *sqlx.DB) ([]SlaveStatus, error) {
db.MapperFunc(strings.Title)
ss := []SlaveStatus{}
err := db.Select(&ss, "SHOW ALL SLAVES STATUS")
return ss, err
}
示例4: GetSlaveStatus
func GetSlaveStatus(db *sqlx.DB) (SlaveStatus, error) {
db.MapperFunc(strings.Title)
ss := SlaveStatus{}
err := db.Get(&ss, "SHOW SLAVE STATUS")
return ss, err
}
示例5: GetPrivileges
func GetPrivileges(db *sqlx.DB, user string) (Privileges, error) {
db.MapperFunc(strings.Title)
priv := Privileges{}
err := db.Get(&priv, "SELECT Select_priv, Process_priv, Super_priv, Repl_slave_priv, Repl_client_priv FROM mysql.user WHERE user = ?", user)
return priv, err
}