combination

package
v0.0.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoArgsSet             = errors.New("args not set")
	ErrCombinationsNotSolved = errors.New("combinations not yet solved")
)

Specify which errors this package can return

Functions

This section is empty.

Types

type Stream

type Stream interface {
	Next(ctx context.Context) (map[string]string, error)
}

Stream is a representation of all possible combinations its args. That uses the Next() function to get each combination. WithSolveAhead() ensures combinations are generated all at once using. If not, it will solve iterativey with nextIterativeCombination()

func NewStream

func NewStream(options ...StreamOption) Stream

NewStream creates a new stream and accepts stream options for it

type StreamOption

type StreamOption func(*stream)

func WithArgs

func WithArgs(args map[string][]string) StreamOption

WithArgs specifies which args to utilize in the new stream

func WithSolveAhead

func WithSolveAhead(boolVar ...bool) StreamOption

WithSolveAhead specifies whether to solve before calling Next or All, only occurs on the first call to Next or All. By using this, the Stream will solve all possible combinations of its args which could take a lot of computation given a large enough input.

Jump to

Keyboard shortcuts

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