Ingen beskrivning
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.

config_project_agent.go 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. tb := sqldef.NewTable("config_project_agent", "配置项目Agent表").
  9. ID("id", 128).NotNull().Comment("主键").End().
  10. String("agent_id", 128).NotNull().Comment("Agent ID").End().
  11. String("project_id", 128).NotNull().Comment("项目ID").End().
  12. String("description", 256).NotNull().Default("''").Comment("描述").End().
  13. JSON("content").NotNull().Comment("内容 (JSON格式)").End().
  14. String("creator", 32).NotNull().Comment("创建人").End().
  15. DateTime("created_at").NotNull().Default("CURRENT_TIMESTAMP").Comment("创建时间").End()
  16. tb.AddIndex("idx_agent_id", "agent_id")
  17. tb.AddIndex("idx_project_id", "project_id")
  18. r.RegisterTable(tb.Build())
  19. })
  20. }
  21. type ProjectAgent struct {
  22. AgentID string `gorm:"column:agent_id;type:varchar(128);not null;primaryKey;comment:Agent ID"`
  23. ProjectID string `gorm:"column:project_id;type:varchar(128);not null;comment:项目ID"`
  24. Description string `gorm:"column:description;type:varchar(256);not null;default:'';comment:描述"`
  25. Content string `gorm:"column:content;type:json;not null;comment:内容 (JSON格式)"`
  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. type ProjectAgentDB struct {
  30. ID string `db:"id"`
  31. AgentID string `db:"agent_id"`
  32. ProjectID string `db:"project_id"`
  33. Description string `db:"description"`
  34. Content string `db:"content"`
  35. Creator string `db:"creator"`
  36. CreatedAt time.Time `db:"created_at"`
  37. }
  38. func (ProjectAgent) TableName() string {
  39. return "config_project_agent"
  40. }