package model import ( "time" ) type Todo struct { ID uint64 `gorm:"primaryKey;autoIncrement" json:"id"` Title string `gorm:"type:varchar(255);not null" json:"title"` Done bool `gorm:"type:tinyint(1);not null;default:0" json:"done"` Priority int `gorm:"type:tinyint(1);not null;default:2" json:"priority"` // 1高 2中 3低 DueDate *time.Time `gorm:"type:date" json:"due_date"` // 可选截止日期 CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"` UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"` } func (Todo) TableName() string { return "todos" } type DailyLog struct { ID uint64 `gorm:"primaryKey;autoIncrement" json:"id"` Date string `gorm:"type:date;not null;uniqueIndex" json:"date"` // 格式:2024-07-24 Morning string `gorm:"type:text" json:"morning"` Afternoon string `gorm:"type:text" json:"afternoon"` Evening string `gorm:"type:text" json:"evening"` CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"` UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"` } func (DailyLog) TableName() string { return "daily_logs" }