You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
860 B
30 lines
860 B
package goods
|
|
|
|
import "recook/internal/dbc"
|
|
|
|
type Video struct {
|
|
ID uint `gorm:"column:id;primary_key" json:"id,omitempty"`
|
|
GoodsID uint `gorm:"column:goods_id" json:"-"`
|
|
Thumbnail string `gorm:"column:thumbnail" json:"thumbnail"`
|
|
URL string `gorm:"column:url" json:"url,omitempty"`
|
|
Duration uint `gorm:"column:duration" json:"duration,omitempty"`
|
|
Size float64 `gorm:"column:size" json:"size,omitempty"`
|
|
}
|
|
|
|
// TableName sets the insert table name for this struct type
|
|
func (*Video) TableName() string {
|
|
return "recook_goods_video"
|
|
}
|
|
|
|
//
|
|
// func (vdo Video) MarshalJSON() ([]byte, error) {
|
|
// if vdo.ID == 0 {
|
|
// return []byte("null"), nil
|
|
// }
|
|
// return json.Marshal(vdo)
|
|
// }
|
|
func (v *Video) SearchByGoodsId(id uint) (rest Video) {
|
|
dbc.DB.Table("recook_goods_video").Where("goods_id=?", id).First(&rest)
|
|
return
|
|
}
|