inputs

package
v0.0.0-...-da4c74d Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2020 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 StructsInput

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

StructsInput represents a record producing input from a Structs formatted file or pipe.

func NewStructsInput

func NewStructsInput(opts *StructsInputOptions) (*StructsInput, error)

NewStructsInput sets up a new StructsInput, the first row is read when this is run. If there is a problem with reading the first row, the error is returned. Otherwise, the returned StructsInput can be reliably consumed with ReadRecord() until ReadRecord() returns nil.

func (*StructsInput) Header

func (StructsInput *StructsInput) Header() []string

Header returns the header of the StructsInput. Either the first row if a header set in the options, or c#, where # is the column number, starting with 0.

func (*StructsInput) Name

func (StructsInput *StructsInput) Name() string

Name returns the name of the Structs being read. By default, either the base filename or 'pipe' if it is a unix pipe

func (*StructsInput) ReadRecord

func (StructsInput *StructsInput) ReadRecord() []string

ReadRecord reads a single record from the Structs. Always returns successfully. If the record is empty, an empty []string is returned. Record expand to match the current row size, adding blank fields as needed. Records never return less then the number of fields in the first row. Returns nil on EOF In the event of a parse error due to an invalid record, it is logged, and an empty []string is returned with the number of fields in the first row, as if the record were empty.

In general, this is a very tolerant of problems Structs reader.

func (*StructsInput) SetName

func (StructsInput *StructsInput) SetName(name string)

SetName overrides the name of the Structs

type StructsInputOptions

type StructsInputOptions struct {
	// Separator is the rune that fields are delimited by.
	Separator rune
	Structs   []interface{}
}

Jump to

Keyboard shortcuts

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