本文整理汇总了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
}