watcher/pkg/model/product.go
timerzz 4b9085fe95
All checks were successful
Build image / build (push) Successful in 1m15s
feat 展示proxy信息,保存pid
2024-04-12 15:29:43 +08:00

46 lines
1.2 KiB
Go

package model
import (
"gorm.io/gorm"
"time"
)
type Product struct {
ID uint `gorm:"primaryKey" json:"id"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
DeletedAt gorm.DeletedAt `gorm:"index"`
UpdateErr bool `json:"updateErr"` //更新出错了
Uid string `json:"uid" gorm:"index:,unique"`
Pid string `json:"pid" gorm:"index:,not null"` //产品编号
Name string `json:"name"`
Brand string `json:"brand"`
Website WebsiteType `json:"website"` //是什么网站
Watch bool `json:"watch"`
Orderable bool `json:"orderable"`
Link string `json:"link"`
Remark string `json:"remark,omitempty"`
AllocationResetDate time.Time `json:"allocationResetDate"` //上次补货时间
PusherIds []uint `json:"pusherIds" gorm:"serializer:json"`
}
type WebsiteType uint
func (t WebsiteType) IsZero() bool {
return t == WebsiteType(0)
}
const (
CoachOutlet WebsiteType = iota + 1
)
func (p *Product) TableName() string {
return "product_info"
}
type Producter interface {
Product() *Product
}