Add classification annotations

This commit is contained in:
2025-10-27 23:12:15 +08:00
parent 3990ec01c6
commit 5aacb88c22
44 changed files with 2769 additions and 2241 deletions

View File

@@ -9,14 +9,13 @@ import (
"gorm.io/gorm"
)
// ============================================================================
// 结构体定义
// ============================================================================
// Variable 变量表模型
// 用于管理应用程序的变量数据
// UUID 为变量的唯一标识符,自动生成并转换为大写
// Alias 为变量别名,便于识别和管理
// Data 为变量数据内容
// Remark 为备注信息,用于描述变量用途
// CreatedAt/UpdatedAt 由 GORM 自动维护
type Variable struct {
// ID主键自增
ID uint `gorm:"primaryKey;comment:变量ID自增主键" json:"id"`
@@ -44,6 +43,10 @@ type Variable struct {
UpdatedAt time.Time `gorm:"comment:更新时间" json:"updated_at"`
}
// ============================================================================
// 结构体方法
// ============================================================================
// BeforeCreate 在创建记录前自动生成UUID和Number
func (variable *Variable) BeforeCreate(tx *gorm.DB) error {
// 生成UUID