1234567891011121314151617181920212223242526272829303132333435363738 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- func (i *ImageSource) TableName() string {
- return "image_sources"
- }
- type ImageSource struct {
- Id int ` description:"Id"`
- ImgName string `description:"图片名称"`
- SrcUrl string `description:"图片资源"`
- PermissionId int `description:"品种"`
- Deleted int `description:"是否删除"`
- CreatedTime time.Time `description:"创建时间"`
- UpdatedTime time.Time `description:"更新时间"`
- }
- func (i *ImageSource) Insert() (insertId int64, err error) {
- o := orm.NewOrm()
- insertId, err = o.Insert(i)
- return
- }
- func (i *ImageSource) Update() (err error) {
- o := orm.NewOrm()
- _, err = o.Update(i, "img_name", "src_url", "permission_id")
- return
- }
- func (i *ImageSource) Delete() (err error) {
- o := orm.NewOrm()
- _, err = o.Update(i, "deleted")
- return
- }
|