Ei kuvausta
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

worker_config.go 1.5KB

12345678910111213141516171819202122232425262728293031323334
  1. package tables
  2. import (
  3. "time"
  4. "git.x2erp.com/qdy/go-db/sqldef"
  5. )
  6. func init() {
  7. sqldef.AddRegistration(func(r *sqldef.Registry) {
  8. // 配置表
  9. tb := sqldef.NewTable("worker_config", "配置表").
  10. ID("worker_config_id", 32).Comment("配置主键,主键").End().
  11. String("package_name", 32).NotNull().Comment("包名称").End().
  12. String("struct_name", 64).NotNull().Comment("结构体名称").End().
  13. String("config_tag", 128).Comment("描述)").End().
  14. JSON("config_value").Comment("配置数据)").End().
  15. String("creator", 32).NotNull().Comment("创建人").End().
  16. DateTime("created_at").NotNull().Default("CURRENT_TIMESTAMP").Comment("创建时间").End()
  17. r.RegisterTable(tb.Build())
  18. })
  19. }
  20. type WorkerConfig struct {
  21. WorkerConfigID string `gorm:"column:worker_config_id;type:varchar(32);primaryKey;not null;comment:配置主键,主键"`
  22. PackageName string `gorm:"column:package_name;type:varchar(32);not null;comment:包名称"`
  23. StructName string `gorm:"column:struct_name;type:varchar(64);not null;comment:结构体名称"`
  24. ConfigTag *string `gorm:"column:config_tag;type:varchar(128);comment:描述)"`
  25. ConfigValue map[string]any `gorm:"column:config_value;type:json;comment:配置数据)"`
  26. Creator string `gorm:"column:creator;type:varchar(32);not null;comment:创建人"`
  27. CreatedAt time.Time `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP;comment:创建时间"`
  28. }
  29. func (WorkerConfig) TableName() string { return "worker_config" }