示例#1
0
// 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
0
func GetMasterStatus(db *sqlx.DB) (MasterStatus, error) {
	db.MapperFunc(strings.Title)
	ms := MasterStatus{}
	err := db.Get(&ms, "SHOW MASTER STATUS")
	return ms, err
}
示例#3
0
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
0
func GetSlaveStatus(db *sqlx.DB) (SlaveStatus, error) {
	db.MapperFunc(strings.Title)
	ss := SlaveStatus{}
	err := db.Get(&ss, "SHOW SLAVE STATUS")
	return ss, err
}
示例#5
0
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
}