Keine Beschreibung
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

project.go 1.7KB

1234567891011121314151617181920212223242526272829303132333435
  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("code_projects", "代码项目表").
  9. ID("id", 32).Comment("项目ID,主键").End().
  10. String("name", 255).NotNull().Comment("项目名称").End().
  11. String("description", 1024).Comment("项目描述").End().
  12. String("path", 512).NotNull().Comment("项目目录路径").End().
  13. String("tenant_id", 8).NotNull().Comment("租户ID").End().
  14. String("creator", 32).NotNull().Comment("创建人").End().
  15. DateTime("created_at").NotNull().Default("CURRENT_TIMESTAMP").Comment("创建时间").End().
  16. DateTime("updated_at").NotNull().Default("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").Comment("更新时间").End()
  17. r.RegisterTable(tb.Build())
  18. })
  19. }
  20. type Project struct {
  21. ID string `gorm:"column:id;type:varchar(32);primaryKey;not null;comment:项目ID,主键"`
  22. Name string `gorm:"column:name;type:varchar(255);not null;comment:项目名称"`
  23. Description string `gorm:"column:description;type:varchar(1024);comment:项目描述"`
  24. Path string `gorm:"column:path;type:varchar(512);not null;comment:项目目录路径"`
  25. TenantID string `gorm:"column:tenant_id;type:varchar(8);not null;comment:租户ID"`
  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. UpdatedAt time.Time `gorm:"column:updated_at;not null;default:CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;comment:更新时间"`
  29. }
  30. func (Project) TableName() string { return "code_projects" }