text

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package text implements source.Source over line-oriented text: files and stdin. Every line becomes one Record, losslessly, blank lines included, so downstream stages see exactly what the input contained.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Source

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

Source yields one Record per line of the underlying reader.

func New

func New(r io.Reader, name string) *Source

New returns a Source reading lines from r. name labels the stream in record IDs (e.g. "stdin", a file path). If r is an io.Closer it is closed by Close.

func Open

func Open(path string) (*Source, error)

Open returns a Source reading lines from the file at path.

func (*Source) Close

func (s *Source) Close() error

Close implements source.Source. Safe to call more than once, and concurrently with Next: closing the reader unblocks a pending read so a cancelled run can stop instead of hanging on stdin or a pipe.

func (*Source) Next

func (s *Source) Next(ctx context.Context) (domain.Record, error)

Next implements source.Source. Line numbers are 1-based.

Jump to

Keyboard shortcuts

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