experiences.go 669 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package datastructure
  2. import (
  3. "notabug.org/apiote/amuse/i18n"
  4. "time"
  5. )
  6. type ExperiencesEntry struct {
  7. ItemInfo
  8. Type string
  9. Id string
  10. Code string
  11. Datetime time.Time
  12. }
  13. type Experiences struct {
  14. List []ExperiencesEntry
  15. Page int
  16. Pages int
  17. Query string
  18. }
  19. func (e ExperiencesEntry) FormatDatetime(strings i18n.Translation) string {
  20. return i18n.FormatDate(e.Datetime, strings.Global["date_format_time"], strings.Global)
  21. }
  22. func (e Experiences) NextPage() int {
  23. if e.Page < e.Pages {
  24. return e.Page + 1
  25. } else {
  26. return e.Page
  27. }
  28. }
  29. func (e Experiences) PrevPage() int {
  30. if e.Page > 1 {
  31. return e.Page - 1
  32. } else {
  33. return e.Page
  34. }
  35. }