fixedlength

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsErrInvalidEnvelope

func IsErrInvalidEnvelope(err error) bool

IsErrInvalidEnvelope checks if an error is of ErrInvalidEnvelope type.

func NewFixedLengthFileFormat

func NewFixedLengthFileFormat(schemaName string) fileformat.FileFormat

NewFixedLengthFileFormat creates a FileFormat for fixed-length files.

func NewReader

func NewReader(inputName string, r io.Reader, decl *FileDecl, xpathStr string) (*reader, error)

NewReader creates an FormatReader for fixed-length file format.

Types

type ByHeaderFooterDecl added in v0.0.4

type ByHeaderFooterDecl struct {
	Header string `json:"header"`
	Footer string `json:"footer"`
}

ByHeaderFooterDecl contains the header and footer regexp patterns for a `by_header_footer` envelope.

type ColumnDecl added in v0.0.4

type ColumnDecl struct {
	Name        string  `json:"name"`
	StartPos    int     `json:"start_pos"` // 1-based. and rune-based.
	Length      int     `json:"length"`    // rune-based length.
	LinePattern *string `json:"line_pattern"`
}

ColumnDecl describes fixed-length envelope column settings for omniparser reader.

type EnvelopeDecl added in v0.0.4

type EnvelopeDecl struct {
	Name           *string             `json:"name"`
	ByHeaderFooter *ByHeaderFooterDecl `json:"by_header_footer"`
	ByRows         *int                `json:"by_rows"`
	NotTarget      bool                `json:"not_target"`
	Columns        []*ColumnDecl       `json:"columns"`
}

EnvelopeDecl describes fixed-length envelope settings for omniparser reader.

type ErrInvalidEnvelope

type ErrInvalidEnvelope string

ErrInvalidEnvelope indicates a fixed-length input envelope is invalid. This is a fatal, non-continuable error.

func (ErrInvalidEnvelope) Error

func (e ErrInvalidEnvelope) Error() string

type FileDecl added in v0.0.4

type FileDecl struct {
	Envelopes []*EnvelopeDecl `json:"envelopes"`
}

FileDecl describes fixed-length specific schema settings for omniparser reader.

Jump to

Keyboard shortcuts

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