| 12345678910111213141516171819202122232425262728293031323334 |
- package tables
-
- import (
- "time"
-
- "git.x2erp.com/qdy/go-db/sqldef"
- )
-
- func init() {
- sqldef.AddRegistration(func(r *sqldef.Registry) {
- // 配置表
- tb := sqldef.NewTable("worker_config", "配置表").
- ID("worker_config_id", 32).Comment("配置主键,主键").End().
- String("package_name", 32).NotNull().Comment("包名称").End().
- String("struct_name", 64).NotNull().Comment("结构体名称").End().
- String("config_tag", 128).Comment("描述)").End().
- JSON("config_value").Comment("配置数据)").End().
- String("creator", 32).NotNull().Comment("创建人").End().
- DateTime("created_at").NotNull().Default("CURRENT_TIMESTAMP").Comment("创建时间").End()
- r.RegisterTable(tb.Build())
- })
- }
-
- type WorkerConfig struct {
- WorkerConfigID string `gorm:"column:worker_config_id;type:varchar(32);primaryKey;not null;comment:配置主键,主键"`
- PackageName string `gorm:"column:package_name;type:varchar(32);not null;comment:包名称"`
- StructName string `gorm:"column:struct_name;type:varchar(64);not null;comment:结构体名称"`
- ConfigTag *string `gorm:"column:config_tag;type:varchar(128);comment:描述)"`
- ConfigValue map[string]any `gorm:"column:config_value;type:json;comment:配置数据)"`
- Creator string `gorm:"column:creator;type:varchar(32);not null;comment:创建人"`
- CreatedAt time.Time `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP;comment:创建时间"`
- }
-
- func (WorkerConfig) TableName() string { return "worker_config" }
|