Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrStopIteration is error when iteration is finished. ErrStopIteration = errors.New("stop iteration") // ErrOffsetIteration is error for failed step/size value. ErrOffsetIteration = errors.New("iteration offset must be positive") )
Functions ¶
func ChanGenerator ¶
ChanGenerator is a range generator.
func ChunkChanGenerator ¶
ChunkChanGenerator splits items by chunks with maximum length=size.
func ChunkFuncGenerator ¶
ChunkFuncGenerator is a function closure chunk splitter.
func FuncGenerator ¶
FuncGenerator is a function closure int generator.
Types ¶
type StructGenerator ¶
StructGenerator is a struct generator.
func NewGenStructChunk ¶
func NewGenStructChunk(items []int, size int) (*StructGenerator, error)
NewGenStructChunk returns new chunk splitter.
func NewStructGenerator ¶
func NewStructGenerator(start, stop, step int) (*StructGenerator, error)
NewStructGenerator returns a new struct generator.
func (*StructGenerator) Next ¶
func (g *StructGenerator) Next() (int, bool)
Next returns a new generation value and flag that it is not the end.
func (*StructGenerator) NextChunk ¶
func (g *StructGenerator) NextChunk() ([]int, bool)
NextChunk returns a new generated chunk and flag that it is not the end.
Click to show internal directories.
Click to hide internal directories.