aboutsummaryrefslogtreecommitdiffhomepage
path: root/common/collections
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2018-09-09 10:15:11 +0200
committerBjørn Erik Pedersen <[email protected]>2018-09-10 09:19:01 +0200
commitfe6676c775b8d917a661238f24fd4a9088f25d50 (patch)
treea84c05a70dc203392db4343a2185cfe0a5714140 /common/collections
parent7a97d3e6bca1e30826e1662b5f299b66aa8ab385 (diff)
downloadhugo-fe6676c775b8d917a661238f24fd4a9088f25d50.tar.gz
hugo-fe6676c775b8d917a661238f24fd4a9088f25d50.zip
tpl/collections: Improve type handling in collections.Slice
Fixes #5188
Diffstat (limited to 'common/collections')
-rw-r--r--common/collections/collections.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/common/collections/collections.go b/common/collections/collections.go
index bb47c8acc..854f705b3 100644
--- a/common/collections/collections.go
+++ b/common/collections/collections.go
@@ -19,3 +19,10 @@ package collections
type Grouper interface {
Group(key interface{}, items interface{}) (interface{}, error)
}
+
+// Slicer definse a very generic way to create a typed slice. This is used
+// in collections.Slice template func to get types such as Pages, PageGroups etc.
+// instead of the less useful []interface{}.
+type Slicer interface {
+ Slice(items []interface{}) (interface{}, error)
+}