hugo: github.com/gohugoio/hugo/common/collections Index | Files

package collections

import "github.com/gohugoio/hugo/common/collections"

Package collections contains common Hugo functionality related to collection handling.

Index

Package Files

append.go collections.go order.go slice.go

func Append Uses

func Append(to interface{}, from ...interface{}) (interface{}, error)

Append appends from to a slice to and returns the resulting slice. If length of from is one and the only element is a slice of same type as to, it will be appended.

func Slice Uses

func Slice(args ...interface{}) interface{}

Slice returns a slice of all passed arguments.

type Grouper Uses

type Grouper interface {
    Group(key interface{}, items interface{}) (interface{}, error)
}

Grouper defines a very generic way to group items by a given key.

type Order Uses

type Order interface {
    // Ordinal is a zero-based ordinal that represents the order of an object
    // in a collection.
    Ordinal() int
}

type Slicer Uses

type Slicer interface {
    Slice(items interface{}) (interface{}, error)
}

Slicer defines 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{}.

Package collections imports 2 packages (graph) and is imported by 53 packages. Updated 2020-06-28. Refresh now. Tools for package owners.