mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
style: minor code style changes
This commit is contained in:
parent
dd70710617
commit
5a1cf2c793
@ -24,7 +24,7 @@ func init() {
|
||||
|
||||
func GetAlertById(query *m.GetAlertByIdQuery) error {
|
||||
alert := m.Alert{}
|
||||
has, err := x.Id(query.Id).Get(&alert)
|
||||
has, err := x.ID(query.Id).Get(&alert)
|
||||
if !has {
|
||||
return fmt.Errorf("could not find alert")
|
||||
}
|
||||
@ -113,7 +113,7 @@ func HandleAlertsQuery(query *m.GetAlertsQuery) error {
|
||||
}
|
||||
|
||||
alerts := make([]*m.Alert, 0)
|
||||
if err := x.Sql(sql.String(), params...).Find(&alerts); err != nil {
|
||||
if err := x.SQL(sql.String(), params...).Find(&alerts); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@ -260,7 +260,7 @@ func SetAlertState(cmd *m.SetAlertStateCommand) error {
|
||||
alert.ExecutionError = cmd.Error
|
||||
}
|
||||
|
||||
sess.Id(alert.Id).Update(&alert)
|
||||
sess.ID(alert.Id).Update(&alert)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@ -324,7 +324,7 @@ func GetAlertStatesForDashboard(query *m.GetAlertStatesForDashboardQuery) error
|
||||
WHERE org_id = ? AND dashboard_id = ?`
|
||||
|
||||
query.Result = make([]*m.AlertStateInfoDTO, 0)
|
||||
err := x.Sql(rawSql, query.OrgId, query.DashboardId).Find(&query.Result)
|
||||
err := x.SQL(rawSql, query.OrgId, query.DashboardId).Find(&query.Result)
|
||||
|
||||
return err
|
||||
}
|
||||
|
@ -17,15 +17,13 @@ func init() {
|
||||
}
|
||||
|
||||
func CreatePlaylist(cmd *m.CreatePlaylistCommand) error {
|
||||
var err error
|
||||
|
||||
playlist := m.Playlist{
|
||||
Name: cmd.Name,
|
||||
Interval: cmd.Interval,
|
||||
OrgId: cmd.OrgId,
|
||||
}
|
||||
|
||||
_, err = x.Insert(&playlist)
|
||||
_, err := x.Insert(&playlist)
|
||||
|
||||
fmt.Printf("%v", playlist.Id)
|
||||
|
||||
@ -47,7 +45,6 @@ func CreatePlaylist(cmd *m.CreatePlaylistCommand) error {
|
||||
}
|
||||
|
||||
func UpdatePlaylist(cmd *m.UpdatePlaylistCommand) error {
|
||||
var err error
|
||||
playlist := m.Playlist{
|
||||
Id: cmd.Id,
|
||||
OrgId: cmd.OrgId,
|
||||
@ -68,7 +65,7 @@ func UpdatePlaylist(cmd *m.UpdatePlaylistCommand) error {
|
||||
Interval: playlist.Interval,
|
||||
}
|
||||
|
||||
_, err = x.Id(cmd.Id).Cols("id", "name", "interval").Update(&playlist)
|
||||
_, err := x.ID(cmd.Id).Cols("id", "name", "interval").Update(&playlist)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
@ -104,7 +101,7 @@ func GetPlaylist(query *m.GetPlaylistByIdQuery) error {
|
||||
}
|
||||
|
||||
playlist := m.Playlist{}
|
||||
_, err := x.Id(query.Id).Get(&playlist)
|
||||
_, err := x.ID(query.Id).Get(&playlist)
|
||||
|
||||
query.Result = &playlist
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user