stdin

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package stdin is the stream source adapter ("stdin"): it reads one stream, such as standard input, whole and emits it as one chunk with Location kind stdin and target {stdin, stdin, unknown}.

Index

Constants

View Source
const DisplayName = "-"

DisplayName is the display name and Location path of standard input.

View Source
const Name = "stdin"

Name is the adapter name.

Variables

View Source
var ErrNoReader = errors.New("stdin source: no reader")

ErrNoReader is returned for a spec without a reader.

View Source
var Target = model.Target{Kind: model.TargetStdin, ID: "stdin", Visibility: model.VisibilityUnknown}

Target is the target of a stream without a TargetID.

Functions

func New

func New(spec source.Spec) (source.Source, error)

New returns the stream source for spec.Reader, named spec.Name ("-" when empty).

Types

type Source

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

Source reads one stream.

func (*Source) Name

func (s *Source) Name() string

Name returns the display name.

func (*Source) Scan

func (s *Source) Scan(ctx context.Context, emit func(candidate.Chunk) bool, warn func(model.Warning)) error

Scan reads the whole stream and emits it as one chunk. A read error becomes a read_failed warning; a stream over the size limit emits nothing and becomes a file_too_large warning, and the rest of the stream is read and discarded. A read that blocks past ctx is abandoned: Scan returns ctx.Err() and the reading goroutine ends when the stream does.

func (*Source) Target

func (s *Source) Target() model.Target

Target returns the stdin target, with the spec's TargetID when set.

Jump to

Keyboard shortcuts

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