stream

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LineHandler

type LineHandler func(line []byte)

LineHandler is a function type that processes a single log line.

type Stream

type Stream struct {
	// contains filtered or unexported fields
}

Stream is an io.Writer that processes incoming data line by line and invokes a callback for each line.

func New

func New(lineHandler LineHandler, errHandler StreamErrHandler) *Stream

func (*Stream) Close

func (s *Stream) Close() error

Close signals that no more data will be written. It closes the writer end of the pipe and waits for the scanner goroutine to process all buffered data and for the lineHandler to be called for all lines.

func (*Stream) Write

func (s *Stream) Write(p []byte) (n int, err error)

Write implements io.Writer. It writes data to the internal pipe.

type StreamErrHandler

type StreamErrHandler func(err error)

StreamErrHandler is a function type that handles errors from the stream processor itself.

Jump to

Keyboard shortcuts

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