example

package module
v0.0.0-...-cbc2a17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

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

func ChanGenerator(start, stop, step int) (chan int, error)

ChanGenerator is a range generator.

func ChunkChanGenerator

func ChunkChanGenerator(items []int, size int) (chan []int, error)

ChunkChanGenerator splits items by chunks with maximum length=size.

func ChunkFuncGenerator

func ChunkFuncGenerator(items []int, size int) func() ([]int, error)

ChunkFuncGenerator is a function closure chunk splitter.

func FuncGenerator

func FuncGenerator(start, stop, step int) func() (int, error)

FuncGenerator is a function closure int generator.

Types

type StructGenerator

type StructGenerator struct {
	sync.Mutex
	// contains filtered or unexported fields
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL