| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- package tables
-
- import (
- "time"
-
- "git.x2erp.com/qdy/go-db/sqldef"
- )
-
- func init() {
- sqldef.AddRegistration(func(r *sqldef.Registry) {
- tb := sqldef.NewTable("config_project_agent", "配置项目Agent表").
- ID("id", 128).NotNull().Comment("主键").End().
- String("agent_id", 128).NotNull().Comment("Agent ID").End().
- String("project_id", 128).NotNull().Comment("项目ID").End().
- String("description", 256).NotNull().Default("''").Comment("描述").End().
- JSON("content").NotNull().Comment("内容 (JSON格式)").End().
- String("creator", 32).NotNull().Comment("创建人").End().
- DateTime("created_at").NotNull().Default("CURRENT_TIMESTAMP").Comment("创建时间").End()
-
- tb.AddIndex("idx_agent_id", "agent_id")
- tb.AddIndex("idx_project_id", "project_id")
-
- r.RegisterTable(tb.Build())
- })
- }
-
- type ProjectAgent struct {
- AgentID string `gorm:"column:agent_id;type:varchar(128);not null;primaryKey;comment:Agent ID"`
- ProjectID string `gorm:"column:project_id;type:varchar(128);not null;comment:项目ID"`
- Description string `gorm:"column:description;type:varchar(256);not null;default:'';comment:描述"`
- Content string `gorm:"column:content;type:json;not null;comment:内容 (JSON格式)"`
- Creator string `gorm:"column:creator;type:varchar(32);not null;comment:创建人"`
- CreatedAt time.Time `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP;comment:创建时间"`
- }
-
- type ProjectAgentDB struct {
- ID string `db:"id"`
- AgentID string `db:"agent_id"`
- ProjectID string `db:"project_id"`
- Description string `db:"description"`
- Content string `db:"content"`
- Creator string `db:"creator"`
- CreatedAt time.Time `db:"created_at"`
- }
-
- func (ProjectAgent) TableName() string {
- return "config_project_agent"
- }
|