package goods import ( "github.com/golangkit/formatime" "recook/internal/dbc" ) type Brand struct { ID uint `gorm:"column:id;primary_key" json:"id"` Name string `gorm:"column:name" json:"name"` Desc string `gorm:"column:desc" json:"desc"` Web string `gorm:"column:web" json:"web"` GoodsCount uint `gorm:"column:goods_count" json:"goodsCount"` LogoURL string `gorm:"column:logo_url" json:"logoUrl"` AuthUrl string `gorm:"column:auth_url" json:"authUrl"` ShowUrl string `gorm:"column:show_url" json:"showUrl"` CreatedAt formatime.Second `gorm:"column:created_at" json:"-"` LastImg string `gorm:"last_img" json:"lastImg"` FirstImg string `gorm:"first_img" json:"firstImg"` FirstWidth int `json:"firstWidth"` FirstHeight int `json:"firstHeight"` LastWidth int `json:"lastWidth"` LastHeight int `json:"lastHeight"` InfoId uint InfoUrl []string `gorm:"-"` } // TableName sets the insert table name for this struct type func (g *Brand) TableName() string { return "recook_goods_brand" } //search by brandId func (g *Brand) SearchById(id uint) (rest Brand) { dbc.DB.Table("recook_goods_brand").Where("id=?", id).First(&rest) return }