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
7aa992bd
Commit
7aa992bd
authored
Apr 17, 2017
by
Alexander Zobnin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
initial category types
parent
f0816b37
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
0 deletions
+66
-0
pkg/services/category/category.go
+39
-0
pkg/services/sqlstore/category.go
+24
-0
pkg/services/sqlstore/sqlstore.go
+3
-0
No files found.
pkg/services/category/category.go
0 → 100644
View file @
7aa992bd
package
category
type
Repository
interface
{
Save
(
item
*
Item
)
error
Update
(
item
*
Item
)
error
Delete
(
params
*
DeleteParams
)
error
Find
(
query
*
FindParams
)
([]
*
Item
,
error
)
}
var
repositoryInstance
Repository
func
GetRepository
()
Repository
{
return
repositoryInstance
}
func
SetRepository
(
rep
Repository
)
{
repositoryInstance
=
rep
}
type
FindParams
struct
{
OrgId
int64
`json:"orgId"`
UserId
int64
`json:"userId"`
Limit
int64
`json:"limit"`
}
type
DeleteParams
struct
{
Id
int64
`json:"id"`
Name
string
`json:"title"`
}
type
ItemType
string
type
Item
struct
{
Id
int64
`json:"id"`
OrgId
int64
`json:"orgId"`
UserId
int64
`json:"userId"`
Name
string
`json:"title"`
Description
string
`json:"text"`
}
pkg/services/sqlstore/category.go
0 → 100644
View file @
7aa992bd
package
sqlstore
import
(
"github.com/grafana/grafana/pkg/services/category"
)
type
SqlCategoryRepo
struct
{
}
func
(
r
*
SqlCategoryRepo
)
Save
(
item
*
category
.
Item
)
error
{
return
nil
}
func
(
r
*
SqlCategoryRepo
)
Update
(
item
*
category
.
Item
)
error
{
return
nil
}
func
(
r
*
SqlCategoryRepo
)
Delete
(
params
*
category
.
DeleteParams
)
error
{
return
nil
}
func
(
r
*
SqlCategoryRepo
)
Find
(
params
*
category
.
FindParams
)
([]
*
category
.
Item
,
error
)
{
return
nil
,
nil
}
pkg/services/sqlstore/sqlstore.go
View file @
7aa992bd
...
...
@@ -12,6 +12,7 @@ import (
"github.com/grafana/grafana/pkg/log"
m
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/services/annotations"
"github.com/grafana/grafana/pkg/services/category"
"github.com/grafana/grafana/pkg/services/sqlstore/migrations"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
"github.com/grafana/grafana/pkg/setting"
...
...
@@ -98,7 +99,9 @@ func SetEngine(engine *xorm.Engine) (err error) {
return
fmt
.
Errorf
(
"Sqlstore::Migration failed err: %v
\n
"
,
err
)
}
// Init repo instances
annotations
.
SetRepository
(
&
SqlAnnotationRepo
{})
category
.
SetRepository
(
&
SqlCategoryRepo
{})
return
nil
}
...
...
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