Documentation ¶
Overview ¶
Package produce contains several methods to generate strings.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Exec ¶ added in v0.9.2
type Exec struct {
// contains filtered or unexported fields
}
Exec runs a command and produces each line the command prints.
func NewExec ¶ added in v0.9.2
NewFile creates a new producer from a reader. If seekable is set to false (e.g. for stdin), Yield() returns an error for subsequent runs.
type File ¶ added in v0.8.0
type File struct {
// contains filtered or unexported fields
}
File produces items from a file.
func NewFile ¶ added in v0.8.0
func NewFile(rd io.ReadSeeker, seekable bool) *File
NewFile creates a new producer from a reader. If seekable is set to false (e.g. for stdin), Yield() returns an error for subsequent runs.
type Filter ¶
type Filter interface { // Count corrects the number of total items to test Count(ctx context.Context, in <-chan int) <-chan int // Select filters the items Select(ctx context.Context, in <-chan []string) <-chan []string }
Filter selects/rejects items received from a source.
type FilterLimit ¶
type FilterLimit struct { Max int CancelProducer func() }
FilterLimit passes through at most Max values.
type FilterSkip ¶
type FilterSkip struct {
Skip int
}
FilterSkip skips the first n values sent over the channel.
type Multiplexer ¶ added in v0.8.0
Multiplexer takes several sources of values and returns the cross product.
type Range ¶
type Range struct {
First, Last int
}
Range defines a range of values which should be tested.
type Ranges ¶
type Ranges struct {
// contains filtered or unexported fields
}
Ranges is a source which yields values from several ranges.
func NewRanges ¶ added in v0.8.0
NewRanges initializes a new source for several ranges. If format is the empty string, "%d" is used.
type Source ¶ added in v0.8.0
type Source interface { // Yield sends all values to ch, and the number of items to the channel // count. Sending stops and ch and count are closed when an error occurs or // the context is cancelled. The channel count should be buffered with at a // size of at least one, so sending the count does not block. Yield(ctx context.Context, ch chan<- string, count chan<- int) error }
Source produces a sequence of values.