You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
716 B
Go

package models
import (
"fmt"
"github.com/astaxie/beego/orm"
)
type TyphoonInfo struct {
Typhoon string `json:"typhoon" orm:"type(text)"`
Tfid string `json:"tfid" orm:"pk;size(20)"`
}
func TyphoonInfoAdd(item *TyphoonInfo) (int64, error) {
return orm.NewOrm().Insert(item)
}
func TyphoonInfoUpdate(item *TyphoonInfo) bool {
o := orm.NewOrm()
if num, err := o.Update(item); err == nil {
fmt.Println(num)
return true
}
return false
}
func GetTyphoonInfo(item *TyphoonInfo) *TyphoonInfo {
var typhoonInfoItem TyphoonInfo
o := orm.NewOrm()
err := o.QueryTable(new(TyphoonInfo)).Filter("tfid",item.Tfid).One(&typhoonInfoItem)
if err == nil {
return &typhoonInfoItem
}
return nil
}