Ash Wilson | c8e6887 | 2014-09-16 10:36:56 -0400 | [diff] [blame] | 1 | package pagination |
| 2 | |
| 3 | // nullPage is an always-empty page that trivially satisfies all Page interfacts. |
| 4 | // It's useful to be returned along with an error. |
| 5 | type nullPage struct{} |
| 6 | |
| 7 | // NextPageURL always returns "" to indicate that there are no more pages to return. |
| 8 | func (p nullPage) NextPageURL() (string, error) { |
| 9 | return "", nil |
| 10 | } |
| 11 | |
| 12 | // IsEmpty always returns true to prevent iteration over nullPages. |
| 13 | func (p nullPage) IsEmpty() (bool, error) { |
| 14 | return true, nil |
| 15 | } |
| 16 | |
| 17 | // LastMark always returns "" because the nullPage contains no items to have a mark. |
| 18 | func (p nullPage) LastMark() (string, error) { |
| 19 | return "", nil |
| 20 | } |