default IsEmpty func for Pages
diff --git a/pagination/marker.go b/pagination/marker.go
index f355afc..26b9d97 100644
--- a/pagination/marker.go
+++ b/pagination/marker.go
@@ -1,5 +1,10 @@
package pagination
+import (
+ "fmt"
+ "reflect"
+)
+
// MarkerPage is a stricter Page interface that describes additional functionality required for use with NewMarkerPager.
// For convenience, embed the MarkedPageBase struct.
type MarkerPage interface {
@@ -33,6 +38,13 @@
return currentURL.String(), nil
}
+func (current MarkerPageBase) IsEmpty() (bool, error) {
+ if b, ok := current.Body.([]interface{}); ok {
+ return len(b) == 0, nil
+ }
+ return true, fmt.Errorf("Error while checking if MarkerPageBase was empty: expected []interface type for Body bot got %+v", reflect.TypeOf(current.Body))
+}
+
// GetBody returns the linked page's body. This method is needed to satisfy the
// Page interface.
func (current MarkerPageBase) GetBody() interface{} {