mysql: testdata

This commit is contained in:
Torkel Ödegaard 2017-03-30 20:01:04 +02:00
parent 34d92b0e79
commit 998f04e1e8
2 changed files with 42 additions and 0 deletions

18
pkg/models/test_data.go Normal file
View 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
}

View 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
})
}