package iterators
import "github.com/gobuffalo/plush/v5/helpers/iterators"
Index ¶
Constants ¶
const ( RangeKey = "range" BetweenKey = "between" UntilKey = "until" GroupByKey = "groupBy" )
Keys to be used in templates for the functions in this package.
Functions ¶
func New ¶
New returns a map of the helpers within this package.
Types ¶
type Iterator ¶
type Iterator interface {
Next() interface{}
}
Iterator type can be implemented and used by the `for` command to build loops in templates
func Between ¶
Between will iterate up to, but not including `b`
Between(0,10) // 0,1,2,3,4,5,6,7,8,9
func GroupBy ¶
GroupBy creates an iterator of groups or sub-slices of the underlying Array or Slice entered where each group is of length Len(underlying) / size. If Len(underlying) == size it will return an iterator with only a single group.
func Range ¶
Range creates an Iterator that will iterate numbers from a to b, including b.
func Until ¶
Until will iterate up to, but not including `a`
Until(3) // 0,1,2
Source Files ¶
between.go group_by.go iterator.go iterators.go range.go until.go
- Version
- v5.0.5 (latest)
- Published
- May 23, 2025
- Platform
- linux/amd64
- Imports
- 4 packages
- Last checked
- 2 weeks ago –
Tools for package owners.