12345678910111213141516171819202122232425262728293031323334 |
- package frontm
- import ("github.com/astaxie/beego/orm"
- "wuyebaoxiuapi/models")
- type Picture struct {
- Id int
- CreateTime int
- Path string
- }
- func NewPicture()(*Picture) {
- return new(Picture)
- }
- func init() {
- orm.RegisterModel(new(Picture))
- }
- func (a *Picture) TableName() string {
- return models.TableName("picture")
- }
- func (a *Picture)Add()(int64, error) {
- return orm.NewOrm().Insert(a)
- }
- func (a *Picture)FindPictureByPath(path string) (*Picture,error) {
- err := orm.NewOrm().QueryTable(models.TableName("picture")).Filter("path", path).One(a)
- if err != nil {
- return nil, err
- }
- return a, nil
- }
|