Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
ea988a37
Commit
ea988a37
authored
Jan 23, 2018
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tech: avoid using deprecated functions
parent
5a1cf2c7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
pkg/services/sqlstore/alert_notification.go
+3
-3
pkg/services/sqlstore/stats.go
+3
-3
No files found.
pkg/services/sqlstore/alert_notification.go
View file @
ea988a37
...
@@ -76,7 +76,7 @@ func GetAlertNotificationsToSend(query *m.GetAlertNotificationsToSendQuery) erro
...
@@ -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
.
S
ql
(
sql
.
String
(),
params
...
)
.
Find
(
&
results
);
err
!=
nil
{
if
err
:=
x
.
S
QL
(
sql
.
String
(),
params
...
)
.
Find
(
&
results
);
err
!=
nil
{
return
err
return
err
}
}
...
@@ -165,7 +165,7 @@ func UpdateAlertNotification(cmd *m.UpdateAlertNotificationCommand) error {
...
@@ -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
.
I
d
(
cmd
.
Id
)
.
Get
(
&
current
);
err
!=
nil
{
if
_
,
err
=
sess
.
I
D
(
cmd
.
Id
)
.
Get
(
&
current
);
err
!=
nil
{
return
err
return
err
}
}
...
@@ -187,7 +187,7 @@ func UpdateAlertNotification(cmd *m.UpdateAlertNotificationCommand) error {
...
@@ -187,7 +187,7 @@ func UpdateAlertNotification(cmd *m.UpdateAlertNotificationCommand) error {
sess
.
UseBool
(
"is_default"
)
sess
.
UseBool
(
"is_default"
)
if
affected
,
err
:=
sess
.
I
d
(
cmd
.
Id
)
.
Update
(
current
);
err
!=
nil
{
if
affected
,
err
:=
sess
.
I
D
(
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"
)
...
...
pkg/services/sqlstore/stats.go
View file @
ea988a37
...
@@ -18,7 +18,7 @@ var activeUserTimeLimit time.Duration = time.Hour * 24 * 30
...
@@ -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
.
S
ql
(
rawSql
)
.
Find
(
&
query
.
Result
)
err
:=
x
.
S
QL
(
rawSql
)
.
Find
(
&
query
.
Result
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
@@ -59,7 +59,7 @@ func GetSystemStats(query *m.GetSystemStatsQuery) error {
...
@@ -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
.
S
ql
(
rawSql
,
activeUserDeadlineDate
)
.
Get
(
&
stats
)
_
,
err
:=
x
.
S
QL
(
rawSql
,
activeUserDeadlineDate
)
.
Get
(
&
stats
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
@@ -114,7 +114,7 @@ func GetAdminStats(query *m.GetAdminStatsQuery) error {
...
@@ -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
.
S
ql
(
rawSql
,
activeUserDeadlineDate
)
.
Get
(
&
stats
)
_
,
err
:=
x
.
S
QL
(
rawSql
,
activeUserDeadlineDate
)
.
Get
(
&
stats
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment