vo.go 1.3 KB

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