mirror of
https://gitee.com/gokins/gokins.git
synced 2024-12-04 20:27:36 +08:00
36 lines
485 B
Go
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
|
|
}
|