Documentation
¶
Overview ¶
Package model 用于存放数据库模型
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AESEncryptString ¶
type AESEncryptString string
AESEncryptString 为 Gorm 自定义字段类型,用 AES-GCM 算法加密
func (*AESEncryptString) GormDataType ¶
func (s *AESEncryptString) GormDataType() string
GormDataType 提供 Gorm 需要的数据类型
func (*AESEncryptString) Scan ¶
func (s *AESEncryptString) Scan(value any) error
Scan 解析 driver 提供的数据
type BaseModel ¶
type BaseModel struct {
Creator string `json:"creator" gorm:"type:varchar(32);null"`
Updater string `json:"updater" gorm:"type:varchar(32);null"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
BaseModel 基础模型
type Category ¶
type Category struct {
BaseModel
ID int64 `json:"id" gorm:"primaryKey"`
Name string `json:"name" gorm:"type:varchar(32);unique;not null"`
Entries []Entry `json:"entries" gorm:"foreignKey:CategoryID"`
}
Category 分类
type Entry ¶
type Entry struct {
BaseModel
CategoryID int64 `json:"categoryID" gorm:"not null"`
Category Category `json:"category" gorm:"foreignKey:CategoryID"`
ID int64 `json:"id" gorm:"primaryKey"`
Name string `json:"name" gorm:"type:varchar(64);unique;not null"`
Desc string `json:"desc" gorm:"type:text;null"`
Price float32 `json:"price" gorm:"not null"`
}
Entry 条目
type PeriodicTask ¶
type PeriodicTask struct {
BaseModel
ID int64 `json:"id" gorm:"primaryKey"`
Cron string `json:"cron" gorm:"type:varchar(32);not null"`
Name string `json:"name" gorm:"type:varchar(128);not null"`
Args datatypes.JSON `json:"args" gorm:"type:json"`
Enabled bool `json:"enabled" gorm:"not null;default:true"`
}
PeriodicTask 周期任务
type Task ¶
type Task struct {
BaseModel
ID int64 `json:"id" gorm:"primaryKey"`
Name string `json:"name" gorm:"type:varchar(128);not null"`
Args datatypes.JSON `json:"args" gorm:"type:json"`
Result datatypes.JSON `json:"result" gorm:"type:json"`
StartedAt time.Time `json:"startedAt" gorm:"type:datetime;default:null"`
Duration time.Duration `json:"duration" gorm:"type:bigint;default:null"`
}
Task 后台任务
Click to show internal directories.
Click to hide internal directories.