gokins/service/dbService/model.go
2020-10-03 22:28:16 +08:00

36 lines
485 B
Go

package dbService
import (
"gokins/comm"
"gokins/model"
)
func GetModel(id int) *model.TModel {
if id <= 0 {
return nil
}
e := new(model.TModel)
ok, err := comm.Db.Where("id=?", id).Get(e)
if err != nil {
return nil
}
if ok {
return e
}
return nil
}
func GetModelRun(id int) *model.TModelRun {
if id <= 0 {
return nil
}
e := new(model.TModelRun)
ok, err := comm.Db.Where("id=?", id).Get(e)
if err != nil {
return nil
}
if ok {
return e
}
return nil
}