Documentation ¶
Overview ¶
Package pipeline provides simple implementations of Pipeline for use in pre-processing streamline.Stream output.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrMap ¶ added in v0.2.0
ErrMap is a Pipeline that allows modifications of individual lines from streamline.Stream with error handling. Implementations can return a nil []byte to indicate a line is to be skipped.
Errors interrupt line processing and are propagated to streamline.Stream.
type Filter ¶ added in v0.2.0
Filter is a Pipeline that allows omission of individual lines from streamline.Stream by returning false on lines that should be skipped.
type Map ¶
Map is a Pipeline that allows modifications of individual lines from streamline.Stream. Implementations can return a nil []byte to indicate a line is to be skipped.
type MultiPipeline ¶
type MultiPipeline []Pipeline
MultiPipeline is a Pipeline that applies all its Pipelines in serial.
func (MultiPipeline) Inactive ¶
func (mp MultiPipeline) Inactive() bool
func (MultiPipeline) ProcessLine ¶
func (mp MultiPipeline) ProcessLine(line []byte) ([]byte, error)
type Pipeline ¶
type Pipeline interface { // Inactive indicates if this Pipeline does anything at all. It is used internally by // streamline.Stream to optimize for cases where accommodating a Pipeline adds overhead. Inactive() bool // ProcessLine returns a modified, unmodified, or omitted line. To omit a line, return // a nil []byte - an empty []byte will be retained. ProcessLine(line []byte) ([]byte, error) }
Pipeline implementations are used to transform the data provided to a streamline.Stream. For example, they are useful for mapping and pruning data. To configure a Stream to use a Pipeline, use (*Stream).WithPipeline(...).
Note that generally a Pipeline should not be used to implement handling of data - use (*Stream).Stream(...) and (*Stream).StreamBytes(...) instead.
type Sample ¶ added in v0.9.0
type Sample struct { // N indicates that this Sample pipeline should only retain every Nth line from the // output. // // If set to 0 or 1, this Pipeline is marked as inactive. N int // contains filtered or unexported fields }
Sample is a Pipeline that only includes every Nth line from streamline.Stream.