mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
mysql: testdata
This commit is contained in:
parent
34d92b0e79
commit
998f04e1e8
18
pkg/models/test_data.go
Normal file
18
pkg/models/test_data.go
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
type InsertSqlTestDataCommand struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
type SqlTestData struct {
|
||||||
|
Id int64
|
||||||
|
Metric1 string
|
||||||
|
Metric2 string
|
||||||
|
ValueBigInt int64
|
||||||
|
ValueDouble float64
|
||||||
|
ValueInt int
|
||||||
|
TimeEpoch int64
|
||||||
|
TimeDateTime time.Time
|
||||||
|
TimeTimeStamp time.Time
|
||||||
|
}
|
24
pkg/services/sqlstore/sql_test_data.go
Normal file
24
pkg/services/sqlstore/sql_test_data.go
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
package sqlstore
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/grafana/grafana/pkg/bus"
|
||||||
|
m "github.com/grafana/grafana/pkg/models"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
bus.AddHandler("sql", InsertSqlTestData)
|
||||||
|
}
|
||||||
|
|
||||||
|
func InsertSqlTestData(cmd *m.InsertSqlTestDataCommand) error {
|
||||||
|
return inTransaction2(func(sess *session) error {
|
||||||
|
|
||||||
|
// create user
|
||||||
|
user := &m.SqlTestData{}
|
||||||
|
|
||||||
|
if _, err := sess.Insert(user); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user