Documentation ¶
Overview ¶
The Tideland Go Library scroller packages helps analyzing a continuously written line by line content, e.g. at the monitoring of log files. Here the Scroller is working in the background and allows to read out of any ReadSeeker (which may be a File) from beginning, end or a given number of lines before the end, filter the output by a filter function and write it into a Writer. If a number of lines and a filter are passed the Scroller tries to find that number of lines matching to the filter.
Index ¶
Constants ¶
const ( ErrNoSource = iota + 1 ErrNoTarget ErrNegativeLines )
Variables ¶
This section is empty.
Functions ¶
func IsNegativeLinesError ¶
IsNegativeLinesError returns true, if the error shows the setting of a negative number of lines to start with.
func IsNoSourceError ¶
IsNoSourceError returns true, if the error signals that no source has been passed.
func IsNoTargetError ¶
IsNoTargetError returns true, if the error signals that no target has been passed.
Types ¶
type FilterFunc ¶
FilterFunc decides if a line shall be scrolled (func is nil or returns true) or not (func returns false).
type Option ¶
Option defines a function setting an option.
func BufferSize ¶
BufferSize allows to set the initial size of the buffer used for reading.
type Scroller ¶
type Scroller struct {
// contains filtered or unexported fields
}
Scroller scrolls and filters a ReadSeeker line by line and writes the data into a Writer.
func NewScroller ¶
NewScroller starts a Scroller for the given source and target. The options can control the number of lines, a filter, the buffer size and the poll time.