1
0

vo.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package syncer
  2. import (
  3. "time"
  4. )
  5. const (
  6. SYNC_ACTION_INSERT = "Insert"
  7. SYNC_ACTION_UPDATE = "Update"
  8. SYNC_ACTION_DELETE = "Delete"
  9. // ClientPriceUpdate
  10. TYPE_CLIENT_PRICE_UPDATE = "ClientPriceUpdate"
  11. )
  12. type Model struct {
  13. ID uint64 `json:"id" gorm:"primary_key"`
  14. Type string `json:"type" gorm:"not null"`
  15. CreatedAt time.Time `json:"create_at"`
  16. UpdatedAt time.Time `json:"update_at"`
  17. }
  18. func (m Model) GetId() uint64 {
  19. return m.ID
  20. }
  21. func (m Model) GetType() string {
  22. return m.Type
  23. }
  24. type SyncLog struct {
  25. Model
  26. DataType string `json:"data_type"` // data type
  27. Data string `json:"data" sql:"type:varchar(5000)"` // data in json string
  28. Action string `json:"action"` // [Insert,Update,Delete]
  29. Synced bool `json:"synced"`
  30. }
  31. // Client data
  32. type ClientPriceUpdate struct {
  33. Model
  34. CompanyId uint64 `json:"company_id"` // only used by FOS
  35. StationId uint64 `json:"station_id"` // only used by FOS
  36. StationName string `json:"station_name"` // only used by FOS
  37. PriceUpdateId uint64 `json:"price_update_id"`
  38. GradeId uint64 `json:"grade_id"`
  39. GradeText string `json:"grade_text"`
  40. GradePrice uint64 `json:"grade_price"`
  41. NewGradePrice uint64 `json:"new_grade_price"`
  42. RecCreatedAt string `json:"rec_created_at"` // record created time
  43. RecUpdatedAt string `json:"rec_updated_at"` // record updated time
  44. }