mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
tech: avoid using deprecated functions
This commit is contained in:
parent
5a1cf2c793
commit
ea988a37dd
@ -76,7 +76,7 @@ func GetAlertNotificationsToSend(query *m.GetAlertNotificationsToSendQuery) erro
|
|||||||
sql.WriteString(`)`)
|
sql.WriteString(`)`)
|
||||||
|
|
||||||
results := make([]*m.AlertNotification, 0)
|
results := make([]*m.AlertNotification, 0)
|
||||||
if err := x.Sql(sql.String(), params...).Find(&results); err != nil {
|
if err := x.SQL(sql.String(), params...).Find(&results); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ func UpdateAlertNotification(cmd *m.UpdateAlertNotificationCommand) error {
|
|||||||
return inTransaction(func(sess *DBSession) (err error) {
|
return inTransaction(func(sess *DBSession) (err error) {
|
||||||
current := m.AlertNotification{}
|
current := m.AlertNotification{}
|
||||||
|
|
||||||
if _, err = sess.Id(cmd.Id).Get(¤t); err != nil {
|
if _, err = sess.ID(cmd.Id).Get(¤t); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,7 +187,7 @@ func UpdateAlertNotification(cmd *m.UpdateAlertNotificationCommand) error {
|
|||||||
|
|
||||||
sess.UseBool("is_default")
|
sess.UseBool("is_default")
|
||||||
|
|
||||||
if affected, err := sess.Id(cmd.Id).Update(current); err != nil {
|
if affected, err := sess.ID(cmd.Id).Update(current); err != nil {
|
||||||
return err
|
return err
|
||||||
} else if affected == 0 {
|
} else if affected == 0 {
|
||||||
return fmt.Errorf("Could not find alert notification")
|
return fmt.Errorf("Could not find alert notification")
|
||||||
|
@ -18,7 +18,7 @@ var activeUserTimeLimit time.Duration = time.Hour * 24 * 30
|
|||||||
func GetDataSourceStats(query *m.GetDataSourceStatsQuery) error {
|
func GetDataSourceStats(query *m.GetDataSourceStatsQuery) error {
|
||||||
var rawSql = `SELECT COUNT(*) as count, type FROM data_source GROUP BY type`
|
var rawSql = `SELECT COUNT(*) as count, type FROM data_source GROUP BY type`
|
||||||
query.Result = make([]*m.DataSourceStats, 0)
|
query.Result = make([]*m.DataSourceStats, 0)
|
||||||
err := x.Sql(rawSql).Find(&query.Result)
|
err := x.SQL(rawSql).Find(&query.Result)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -59,7 +59,7 @@ func GetSystemStats(query *m.GetSystemStatsQuery) error {
|
|||||||
|
|
||||||
activeUserDeadlineDate := time.Now().Add(-activeUserTimeLimit)
|
activeUserDeadlineDate := time.Now().Add(-activeUserTimeLimit)
|
||||||
var stats m.SystemStats
|
var stats m.SystemStats
|
||||||
_, err := x.Sql(rawSql, activeUserDeadlineDate).Get(&stats)
|
_, err := x.SQL(rawSql, activeUserDeadlineDate).Get(&stats)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -114,7 +114,7 @@ func GetAdminStats(query *m.GetAdminStatsQuery) error {
|
|||||||
activeUserDeadlineDate := time.Now().Add(-activeUserTimeLimit)
|
activeUserDeadlineDate := time.Now().Add(-activeUserTimeLimit)
|
||||||
|
|
||||||
var stats m.AdminStats
|
var stats m.AdminStats
|
||||||
_, err := x.Sql(rawSql, activeUserDeadlineDate).Get(&stats)
|
_, err := x.SQL(rawSql, activeUserDeadlineDate).Get(&stats)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user