default IsEmpty func for Pages
diff --git a/pagination/linked.go b/pagination/linked.go
index e9bd8de..431464b 100644
--- a/pagination/linked.go
+++ b/pagination/linked.go
@@ -1,6 +1,9 @@
package pagination
-import "fmt"
+import (
+ "fmt"
+ "reflect"
+)
// LinkedPageBase may be embedded to implement a page that provides navigational "Next" and "Previous" links within its result.
type LinkedPageBase struct {
@@ -60,6 +63,13 @@
}
}
+func (current LinkedPageBase) IsEmpty() (bool, error) {
+ if b, ok := current.Body.([]interface{}); ok {
+ return len(b) == 0, nil
+ }
+ return true, fmt.Errorf("Error while checking if LinkedPageBase 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 LinkedPageBase) GetBody() interface{} {