Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsErrInvalidFixedLength ¶
IsErrInvalidFixedLength checks if the `err` is of ErrInvalidFixedLength type.
func NewFixedLengthFileFormat ¶
func NewFixedLengthFileFormat(schemaName string) fileformat.FileFormat
NewFixedLengthFileFormat creates a FileFormat for 'fixedlength2'.
Types ¶
type ColumnDecl ¶
type ColumnDecl struct { Name string `json:"name,omitempty"` StartPos int `json:"start_pos,omitempty"` // 1-based. and rune-based. Length int `json:"length,omitempty"` // rune-based length. LineIndex *int `json:"line_index,omitempty"` // 1-based. LinePattern *string `json:"line_pattern,omitempty"` // contains filtered or unexported fields }
ColumnDecl describes a column of an envelope.
type EnvelopeDecl ¶
type EnvelopeDecl struct { Name string `json:"name,omitempty"` Rows *int `json:"rows,omitempty"` Header *string `json:"header,omitempty"` Type *string `json:"type,omitempty"` IsTarget bool `json:"is_target,omitempty"` Min *int `json:"min,omitempty"` Max *int `json:"max,omitempty"` Columns []*ColumnDecl `json:"columns,omitempty"` Children []*EnvelopeDecl `json:"child_envelopes,omitempty"` // contains filtered or unexported fields }
EnvelopeDecl describes an envelope of a fixed-length input. If Rows/Header/Footer are all nil, then it defaults to Rows = 1. If Rows specified, then Header/Footer must be nil. (JSON schema validation will ensure this.) If Header is specified, Rows must be nil. (JSON schema validation will ensure this.) Footer is optional; If not specified, Header will be used for a single-line envelope matching.
func (*EnvelopeDecl) ChildDecls ¶
func (e *EnvelopeDecl) ChildDecls() []flatfile.RecDecl
func (*EnvelopeDecl) DeclName ¶
func (e *EnvelopeDecl) DeclName() string
func (*EnvelopeDecl) Group ¶
func (e *EnvelopeDecl) Group() bool
func (*EnvelopeDecl) MaxOccurs ¶
func (e *EnvelopeDecl) MaxOccurs() int
MaxOccurs defaults to unbounded. Fixed-length input most common scenario is min=0/max=unbounded.
func (*EnvelopeDecl) MinOccurs ¶
func (e *EnvelopeDecl) MinOccurs() int
MinOccurs defaults to 0. Fixed-length input most common scenario is min=0/max=unbounded.
func (*EnvelopeDecl) Target ¶
func (e *EnvelopeDecl) Target() bool
type ErrInvalidFixedLength ¶
type ErrInvalidFixedLength string
ErrInvalidFixedLength indicates the fixed-length content is corrupted or IO failure. This is a fatal, non-continuable error.
func (ErrInvalidFixedLength) Error ¶
func (e ErrInvalidFixedLength) Error() string
Error implements error interface.
type FileDecl ¶
type FileDecl struct {
Envelopes []*EnvelopeDecl `json:"envelopes,omitempty"`
}
FileDecl describes fixed-length schema `file_declaration` setting.