Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoReader = errors.New("no input")
ErrNoReader is returned if there is no reader defined.
Functions ¶
This section is empty.
Types ¶
type Conf ¶
type Conf func(*MultiReader) error
Conf is used to configure the MultiReader.
func WithPaths ¶
WithPaths searches through the path and adds any files it finds to the MultiReader. Each path will become its reader's name in the process. It returns an error if any of given files are not found. It ignores any files that cannot be read or opened.
func WithReader ¶
func WithReader(name string, r io.ReadCloser) Conf
WithReader adds the {name,r} reader to the MultiReader. If name is empty, the key will not be written in the output. You can provide as many empty names as you need.
type MultiReader ¶
type MultiReader struct {
// contains filtered or unexported fields
}
MultiReader holds one or more io.ReadCloser and reads their contents when Read() method is called in order. The reader is loaded lazily if it is a file to prevent the system going out of file descriptors.
func NewMultiReader ¶
func NewMultiReader(input ...Conf) (*MultiReader, error)
NewMultiReader creates an instance of the MultiReader and passes it to all input functions.
func (*MultiReader) FileName ¶ added in v0.5.2
func (m *MultiReader) FileName() string
FileName returns the current reader's name.