readlist.go 557 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package datastructure
  2. type ReadlistEntry struct {
  3. ItemInfo
  4. Id string
  5. HasPrevious bool
  6. }
  7. type Readlist struct {
  8. List []ReadlistEntry
  9. Page int
  10. Pages int
  11. Genres map[int]string
  12. Query string
  13. }
  14. func (w *Readlist) SetGenres(m map[int]string) {
  15. w.Genres = m
  16. }
  17. func (w *Readlist) GetType() ItemType {
  18. return ItemTypeBook
  19. }
  20. func (w Readlist) NextPage() int {
  21. if w.Page < w.Pages {
  22. return w.Page + 1
  23. } else {
  24. return w.Page
  25. }
  26. }
  27. func (w Readlist) PrevPage() int {
  28. if w.Page > 1 {
  29. return w.Page - 1
  30. } else {
  31. return w.Page
  32. }
  33. }