Nav apraksta
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

sync_solution.go 2.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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("sync_solution", "同步方案主表 - 管理不同的数据同步方案").
  9. ID("id", 128).NotNull().Comment("主键").End().
  10. String("solution_code", 32).NotNull().Comment("方案代码").End().
  11. String("solution_type", 20).NotNull().Comment("方案类型: 全量,增量,计算").End().
  12. String("solution_name", 100).NotNull().Comment("方案名称").End().
  13. String("description", 500).NotNull().Default("''").Comment("方案描述").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. DateTime("deleted_at").Comment("删除时间").End()
  18. tb.AddIndex("idx_solution_code", "solution_code")
  19. r.RegisterTable(tb.Build())
  20. })
  21. }
  22. type SyncSolution struct {
  23. SolutionCode string `gorm:"column:solution_code;type:varchar(32);not null;primaryKey;comment:方案代码"`
  24. SolutionType string `gorm:"column:solution_type;type:varchar(20);not null;comment:方案类型: 全量,增量,计算"`
  25. SolutionName string `gorm:"column:solution_name;type:varchar(100);not null;comment:方案名称"`
  26. Description string `gorm:"column:description;type:varchar(500);not null;default:'';comment:方案描述"`
  27. Creator string `gorm:"column:creator;type:varchar(32);not null;comment:创建人"`
  28. CreatedAt time.Time `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP;comment:创建时间"`
  29. UpdatedAt time.Time `gorm:"column:updated_at;not null;default:CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;comment:更新时间"`
  30. DeletedAt *time.Time `gorm:"column:deleted_at;comment:删除时间"`
  31. }
  32. type SyncSolutionDB struct {
  33. ID string `db:"id" json:"id"`
  34. SolutionCode string `db:"solution_code" json:"solutionCode"`
  35. SolutionType string `db:"solution_type" json:"solutionType"`
  36. SolutionName string `db:"solution_name" json:"solutionName"`
  37. Description string `db:"description" json:"description"`
  38. Creator string `db:"creator" json:"creator"`
  39. CreatedAt time.Time `db:"created_at" json:"createdAt"`
  40. UpdatedAt time.Time `db:"updated_at" json:"updatedAt"`
  41. DeletedAt *time.Time `db:"deleted_at" json:"deletedAt"`
  42. }
  43. func (SyncSolution) TableName() string {
  44. return "sync_solution"
  45. }