preferences.go 831 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package models
  2. import (
  3. "errors"
  4. )
  5. // Typed errors
  6. var (
  7. ErrPreferencesNotFound = errors.New("Preferences not found")
  8. )
  9. type Preferences struct {
  10. Id int64
  11. PrefId int64
  12. PrefType string
  13. PrefData map[string]interface{}
  14. }
  15. // ---------------------
  16. // QUERIES
  17. type GetPreferencesQuery struct {
  18. PrefId int64
  19. PrefType string
  20. Result *Preferences
  21. }
  22. // ---------------------
  23. // COMMANDS
  24. type SavePreferencesCommand struct {
  25. PrefData map[string]interface{} `json:"prefData" binding:"Required"`
  26. PrefId int64 `json:"-"`
  27. PrefType string `json:"-"`
  28. }
  29. // ----------------------
  30. // DTO & Projections
  31. type PreferencesDTO struct {
  32. PrefId int64 `json:"prefId"`
  33. PrefType string `json:"prefType"`
  34. PrefData map[string]interface{} `json:"prefData"`
  35. }