2026-07-27 00:18:42 +08:00
|
|
|
|
package models
|
|
|
|
|
|
|
|
|
|
|
|
import "git.apinb.com/bsm-sdk/core/database"
|
|
|
|
|
|
|
2026-07-27 14:28:23 +08:00
|
|
|
|
// SafeRule 对应 safe_rule,保存安全规则。
|
|
|
|
|
|
type SafeRule struct {
|
2026-07-27 12:02:08 +08:00
|
|
|
|
Entity // 公共实体字段
|
|
|
|
|
|
RuleCode string `gorm:"column:rule_code;type:varchar(64);not null;uniqueIndex" json:"rule_code"` // rule_code 业务字段
|
|
|
|
|
|
VersionNo int `gorm:"column:version_no;not null;default:1" json:"version_no"` // version_no 业务字段
|
2026-07-27 15:31:22 +08:00
|
|
|
|
Threshold string `gorm:"column:threshold;type:text;not null;default:''" json:"threshold"` // threshold 业务字段
|
2026-07-27 12:02:08 +08:00
|
|
|
|
Action string `gorm:"column:action;type:varchar(64);not null" json:"action"` // action 业务字段
|
2026-07-27 15:31:22 +08:00
|
|
|
|
GrayScope string `gorm:"column:gray_scope;type:text;not null;default:''" json:"gray_scope"` // gray_scope 业务字段
|
2026-07-27 00:18:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-07-27 14:28:23 +08:00
|
|
|
|
func init() { database.AppendMigrate(&SafeRule{}) }
|
|
|
|
|
|
func (table *SafeRule) TableName() string { return "safe_rule" }
|