lineio

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEndOfTail error = errors.New("end of tail")
View Source
var ErrLineTooLong error = errors.New("a line doesnot fit in the buffer")

Functions

This section is empty.

Types

type Line

type Line struct {
	// No is the number of current line, starting from 1
	No int
	// LineStart is the start offset of current line in the File, in number of bytes, staring from 0
	LineStart int64
	// LineEnding is the ending offset of current line in the File, in number of bytes, staring from 0, pointing at current \n
	LineEnding int64
	// Raw holds the line content, excluding \n
	Raw []byte
}

func (Line) Copy

func (l Line) Copy() Line

type Scanner added in v0.2.0

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

func NewScanner added in v0.2.0

func NewScanner(fd *os.File, buf []byte, opts ...ScannerOption) Scanner

func (Scanner) Err added in v0.2.0

func (s Scanner) Err() error

func (Scanner) Line added in v0.2.0

func (s Scanner) Line() Line

func (*Scanner) ResumeFromEOF added in v0.2.0

func (s *Scanner) ResumeFromEOF() (bool, error)

func (*Scanner) Scan added in v0.2.0

func (s *Scanner) Scan() bool

type ScannerOption added in v0.2.0

type ScannerOption func(*Scanner)

func WithStartPos added in v0.2.0

func WithStartPos(startingByte int64, startingLine int) ScannerOption

type Tailer

type Tailer struct {
	StartingByte int64
	StartingLine int
	// contains filtered or unexported fields
}

func NewTailer

func NewTailer(fd io.ReadSeeker, buf []byte) *Tailer

func (*Tailer) Tail

func (t *Tailer) Tail(ctx context.Context, backoff time.Duration, consume func([]Line) error) error

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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