DataHouse/models/temperature/temperature.go

33 lines
482 B
Go

package temperature
import (
"github.com/astaxie/beego/orm"
"datahouse/models/database"
"time"
)
type tempTable struct {
Id int64
HorodateGMT time.Time `orm:"auto_now;type(datetime)"`
Value int64
}
func init() {
orm.RegisterModel(new(tempTable))
}
/**
* Add the value into the database.
*/
func AddData(value int64) {
o := orm.NewOrm()
o.Using(database.Alias)
tmpTable := new(tempTable)
tmpTable.Value = value
o.Insert(tmpTable)
}