package models import ( "github.com/astaxie/beego/orm" "time" ) type NmcNowWeather struct { Id int64 `json:"id" orm:"pk;auto;column(id);size(20)"` Code string `json:"code" orm:"column(code);size(255)"` Weather string `json:"weather" orm:"column(weather);type(text)"` WeatherDate string `json:"weatherDate" orm:"column(weather_date);size(255)"` CreateDate time.Time `json:"createDate" orm:"column(create_date);auto_now_add;type(datetime)"` LastUpdateDate time.Time `json:"lastUpdateDate" orm:"column(last_update_date);auto_now;type(datetime)"` } func init() { orm.RegisterModel(new(NmcNowWeather)) } func AddNmcNowWeather(item *NmcNowWeather) (int64, error) { return orm.NewOrm().Insert(item) } func GetNmcNowWeatherList() []*NmcNowWeather { items := make([]*NmcNowWeather, 0) orm.NewOrm().QueryTable(new(NmcNowWeather)).All(&items) return items }