Files
bl/modules/config/model/fight_rule.go
xinian 1969c01f3e
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
feat: 添加战胜规则配置模块
2026-03-21 00:57:18 +08:00

40 lines
983 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package model
import (
"blazing/cool"
)
// 表名常量
const TableNameFightRule = "config_fight_rule"
// FightRule 战胜规则配置表
// 对应 rule 包中 Rule300-Rule316 的配置参数
type FightRule struct {
*cool.Model // 嵌入基础Model包含主键、创建/更新时间等通用字段)
RuleIdx uint32 `gorm:"not null;uniqueIndex:idx_rule_idx;comment:'规则索引300-316'" json:"rule_idx"`
Args []int `gorm:"type:jsonb;comment:'规则参数JSON数组对应RuleBase.args'" json:"args"`
Desc string `gorm:"type:varchar(255);default:'';comment:'规则描述'" json:"desc"`
}
// TableName 指定表名
func (*FightRule) TableName() string {
return TableNameFightRule
}
// GroupName 指定表分组
func (*FightRule) GroupName() string {
return "default"
}
// NewFightRule 创建战胜规则表实例
func NewFightRule() *FightRule {
return &FightRule{
Model: cool.NewModel(),
}
}
func init() {
cool.CreateTable(&FightRule{})
}