Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SaveOrCreateById ¶
Types ¶
type Entity ¶
type Entity struct {
Id uint64 `gorm:"primaryKey;column:id;autoIncrement;not null;" json:"id"` // 日志ID
EntityType string `gorm:"column:entity_type;type:varchar(50);not null;default:'';" json:"entityType"` // 实体类型
EntityId uint64 `gorm:"column:entity_id;type:bigint unsigned;not null;default:0;" json:"entityId"` // 实体ID
OperationType string `gorm:"column:operation_type;type:varchar(20);not null;default:'';" json:"operationType"` // 操作类型(create/update/delete)
FieldName string `gorm:"column:field_name;type:varchar(100);" json:"fieldName"` // 字段名称
OldValue string `gorm:"column:old_value;type:text;" json:"oldValue"` // 旧值
NewValue string `gorm:"column:new_value;type:text;" json:"newValue"` // 新值
Metadata string `gorm:"column:metadata;type:json;" json:"metadata"` // 扩展元数据
UserId uint64 `gorm:"column:user_id;type:bigint unsigned;not null;default:0;" json:"userId"` // 操作用户ID
IpAddress string `gorm:"column:ip_address;type:varchar(45);" json:"ipAddress"` // 操作IP地址
UserAgent string `gorm:"column:user_agent;type:text;" json:"userAgent"` // 用户代理
CreatedAt time.Time `gorm:"column:created_at;index;autoCreateTime;<-:create;" json:"createdAt"` // 创建时间
}
Click to show internal directories.
Click to hide internal directories.