utils

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2020 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const (
	OutputJsonFormat  = "json"
	OutputMetroFormat = "metro"
)

Variables

View Source
var (
	// ErrNonAlphanumeric is given when a field has non-alphanumeric characters
	ErrNonAlphanumeric = errors.New("has non alphanumeric characters")
	// ErrUpperAlpha is given when a field is not in uppercase
	ErrUpperAlpha = errors.New("is not uppercase A-Z or 0-9")
	// ErrFieldRequired is given when a field is required
	ErrFieldRequired = errors.New("is a required field")
	// ErrUpperAlpha is given when a field is not numeric characters
	ErrNumeric = errors.New("is not numeric characters")
	// ErrUpperAlpha is given when a field is an invalid phone number
	ErrPhoneNumber = errors.New("is an invalid phone number")
	// ErrValidYear is given when there's an invalid date
	ErrValidDate = errors.New("is an invalid Date")
	// ErrValidYear is given when a segment has an invalid length
	ErrSegmentLength = errors.New("has an invalid length")
	// ErrValidField is given when there's an invalid field
	ErrValidField = errors.New("is an invalid field")
	// ErrShortRecord is given when the record is too short
	ErrShortRecord = errors.New("is too short / missing data")
)

Functions

func IsMetroFile

func IsMetroFile(s string) bool

Metro file check

func IsVariableLength

func IsVariableLength(s string) bool

Variable block check

func NewErrApplicableSegment

func NewErrApplicableSegment(name string) error

NewErrApplicableSegment returns a error that can't support applicable segment

func NewErrBlockDescriptorWord

func NewErrBlockDescriptorWord() error

NewErrBlockDescriptorWord returns a error that

func NewErrParse

func NewErrParse() error

NewErrParse returns a error that has invalid parse data

func NewErrValidFileFormat

func NewErrValidFileFormat(name string) error

NewErrValidSegment returns a error that has invalid segment

func NewErrValidRecord

func NewErrValidRecord(name string) error

NewErrValidRecord returns a error if is invalid record

func NewErrValidValue

func NewErrValidValue(field string) error

NewErrValidValue returns a error that has invalid value

func ReadFile

func ReadFile(f *os.File) string

File Read

Types

This section is empty.

Jump to

Keyboard shortcuts

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