canal.go 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. package canal
  2. import (
  3. xtime "go-common/library/time"
  4. )
  5. // TableName case tablename
  6. func (*Canal) TableName() string {
  7. return "master_info"
  8. }
  9. // Canal canal
  10. type Canal struct {
  11. ID int64 `gorm:"column:id" json:"id"`
  12. Addr string `gorm:"column:addr" json:"addr" form:"addr" validate:"required"`
  13. BinName string `gorm:"column:bin_name" json:"bin_name" form:"bin_name"`
  14. BinPos int32 `gorm:"column:bin_pos" json:"bin_pos" form:"bin_pos"`
  15. Remark string `gorm:"column:remark" json:"remark" form:"remark"`
  16. Leader string `gorm:"column:leader" json:"leader" form:"leader"`
  17. Cluster string `gorm:"column:cluster" json:"project" form:"project"`
  18. CTime xtime.Time `gorm:"column:ctime" json:"ctime"`
  19. MTime xtime.Time `gorm:"column:mtime" json:"mtime"`
  20. IsDelete int `gorm:"column:is_delete" json:"is_delete"`
  21. }
  22. //ScanReq canal scan req
  23. type ScanReq struct {
  24. Addr string `form:"addr" validate:"required"`
  25. }
  26. //Results canalscan resp
  27. type Results struct {
  28. ID int64 `json:"id"`
  29. Addr string `json:"addr"`
  30. Cluster string `json:"project"`
  31. Leader string `json:"leader"`
  32. Document *Document `json:"document"`
  33. }
  34. //EditReq canal edit req
  35. type EditReq struct {
  36. ID int64 `form:"id" validate:"required"`
  37. BinName string `form:"bin_name"`
  38. BinPos int32 `form:"bin_pos"`
  39. Remark string `form:"remark"`
  40. Leader string `form:"leader"`
  41. Project string `form:"project"`
  42. }
  43. //ListReq canallist req
  44. type ListReq struct {
  45. Addr string `form:"addr"`
  46. Project string `form:"project"`
  47. Status int8 `form:"status"`
  48. Pn int `form:"pn" default:"1"`
  49. Ps int `form:"ps" default:"20"`
  50. }
  51. //Paper canallist resp
  52. type Paper struct {
  53. Total int `json:"total"`
  54. Pn int `json:"pn"`
  55. Ps int `json:"ps"`
  56. Items interface{} `json:"items"`
  57. }
  58. //Conf is
  59. type Conf struct {
  60. ID int64 `json:"id"`
  61. Comment string `json:"comment"`
  62. }
  63. //Document document
  64. type Document struct {
  65. Instance struct {
  66. User string `json:"user" toml:"user"`
  67. Password string `json:"password" toml:"password"`
  68. MonitorPeriod string `json:"monitor_period" toml:"monitor_period"`
  69. ServerID int64 `json:"server_id" toml:"server_id"`
  70. Db []*struct {
  71. Schema string `json:"schema" toml:"schema"`
  72. Table []*struct {
  73. Name string `json:"name" toml:"name"`
  74. Primarykey []string `json:"primarykey,omitempty" toml:"primarykey"`
  75. Omitfield []string `json:"omitfield,omitempty" toml:"omitfield"`
  76. } `json:"table" toml:"table"`
  77. Databus *struct {
  78. Group string `json:"group" toml:"group"`
  79. Topic string `json:"topic" toml:"topic"`
  80. Action string `json:"action" toml:"action"`
  81. Name string `json:"name" toml:"name"`
  82. Proto string `json:"proto" toml:"proto"`
  83. Addr string `json:"addr" toml:"addr"`
  84. Idle int `json:"idle" toml:"idle"`
  85. Active int `json:"active" toml:"active"`
  86. DialTimeout string `json:"dialTimeout" toml:"dialTimeout"`
  87. ReadTimeout string `json:"readTimeout" toml:"readTimeout"`
  88. WriteTimeout string `json:"writeTimeout" toml:"writeTimeout"`
  89. IdleTimeout string `json:"idleTimeout" toml:"idleTimeout"`
  90. } `json:"databus" toml:"databus"`
  91. Infoc *struct {
  92. TaskID string `json:"taskID" toml:"taskID"`
  93. Proto string `json:"proto" toml:"proto"`
  94. Addr string `json:"addr" toml:"addr"`
  95. ReporterAddr string `json:"reporterAddr" toml:"reporterAddr"`
  96. } `json:"infoc" toml:"infoc"`
  97. } `json:"db"`
  98. } `json:"instance"`
  99. }