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
423eca6e
Commit
423eca6e
authored
Jan 21, 2016
by
Anthony Woods
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add support for fetching appSettings by appId
parent
fd523204
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
1 deletions
+27
-1
pkg/models/app_settings.go
+14
-1
pkg/services/sqlstore/app_settings.go
+13
-0
No files found.
pkg/models/app_settings.go
View file @
423eca6e
package
models
import
"time"
import
(
"errors"
"time"
)
var
(
ErrAppSettingNotFound
=
errors
.
New
(
"AppSetting not found"
)
)
type
AppSettings
struct
{
Id
int64
...
...
@@ -33,3 +40,9 @@ type GetAppSettingsQuery struct {
OrgId
int64
Result
[]
*
AppSettings
}
type
GetAppSettingByAppIdQuery
struct
{
AppId
string
OrgId
int64
Result
*
AppSettings
}
pkg/services/sqlstore/app_settings.go
View file @
423eca6e
...
...
@@ -9,6 +9,7 @@ import (
func
init
()
{
bus
.
AddHandler
(
"sql"
,
GetAppSettings
)
bus
.
AddHandler
(
"sql"
,
GetAppSettingByAppId
)
bus
.
AddHandler
(
"sql"
,
UpdateAppSettings
)
}
...
...
@@ -19,6 +20,18 @@ func GetAppSettings(query *m.GetAppSettingsQuery) error {
return
sess
.
Find
(
&
query
.
Result
)
}
func
GetAppSettingByAppId
(
query
*
m
.
GetAppSettingByAppIdQuery
)
error
{
appSetting
:=
m
.
AppSettings
{
OrgId
:
query
.
OrgId
,
AppId
:
query
.
AppId
}
has
,
err
:=
x
.
Get
(
&
appSetting
)
if
err
!=
nil
{
return
err
}
else
if
has
==
false
{
return
m
.
ErrAppSettingNotFound
}
query
.
Result
=
&
appSetting
return
nil
}
func
UpdateAppSettings
(
cmd
*
m
.
UpdateAppSettingsCmd
)
error
{
return
inTransaction2
(
func
(
sess
*
session
)
error
{
var
app
m
.
AppSettings
...
...
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