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 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 not be included (i.e. 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 MapErr ¶ added in v0.12.0
MapErr 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 MultiPipeline ¶
type MultiPipeline []Pipeline
MultiPipeline is a Pipeline that applies all its Pipelines in serial.
func (MultiPipeline) ProcessLine ¶
func (mp MultiPipeline) ProcessLine(line []byte) ([]byte, error)
ProcessLine will provide the line to all active pipelines in the MultiPipeline in serial, passing the result of each pipeline to the next. If any pipeline indicates a line should be skipped by returning a nil line, then ProcessLine returns immediately.
type Pipeline ¶
type Pipeline interface { // ProcessLine returns a modified, unmodified, or omitted line. To omit a line, return // a nil []byte - an empty []byte will cause an empty line to be retained. // // Implementations must not retain line. 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.