mirror of
https://github.com/skyle1995/NetworkAuth.git
synced 2026-05-25 02:24:05 +08:00
Add classification annotations
This commit is contained in:
@@ -9,14 +9,13 @@ import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// ============================================================================
|
||||
// 结构体定义
|
||||
// ============================================================================
|
||||
|
||||
// Function 函数表模型
|
||||
// 用于管理应用程序的函数代码
|
||||
// UUID 为函数的唯一标识符,自动生成并转换为大写
|
||||
// Alias 为函数别名,便于识别和管理
|
||||
// Code 为函数代码内容
|
||||
// Remark 为备注信息,用于描述函数用途
|
||||
// CreatedAt/UpdatedAt 由 GORM 自动维护
|
||||
|
||||
type Function struct {
|
||||
// ID:主键,自增
|
||||
ID uint `gorm:"primaryKey;comment:函数ID,自增主键" json:"id"`
|
||||
@@ -44,6 +43,10 @@ type Function struct {
|
||||
UpdatedAt time.Time `gorm:"comment:更新时间" json:"updated_at"`
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// 结构体方法
|
||||
// ============================================================================
|
||||
|
||||
// BeforeCreate 在创建记录前自动生成UUID和Number
|
||||
func (function *Function) BeforeCreate(tx *gorm.DB) error {
|
||||
// 生成UUID
|
||||
@@ -59,4 +62,4 @@ func (function *Function) BeforeCreate(tx *gorm.DB) error {
|
||||
// TableName 指定表名
|
||||
func (Function) TableName() string {
|
||||
return "functions"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user