go-common/app/admin/main/feed/dao/show/app_active.go

25 lines
547 B
Go
Raw Normal View History

2019-04-22 10:49:16 +00:00
package show
import (
"context"
"go-common/app/admin/main/feed/model/show"
"go-common/library/log"
"github.com/jinzhu/gorm"
)
// AAFindByID app active table find by id
func (d *Dao) AAFindByID(c context.Context, id int64) (active *show.AppActive, err error) {
active = &show.AppActive{}
if err = d.DB.Model(&show.AppActive{}).Where("id = ?", id).First(active).Error; err != nil {
if err == gorm.ErrRecordNotFound {
active = nil
err = nil
} else {
log.Error("dao.ormshow.app_active.findByID error(%v)", err)
}
}
return
}