utils

package
v0.3.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// Character Format (Fixed or variable blocked)
	CharacterFileFormat = "Character"
	// Packed Format (Variable blocked)
	PackedFileFormat = "Packed"
	// Name of header record
	HeaderRecordName = "header"
	// Name of trailer record
	TrailerRecordName = "trailer"
	// Name of data record
	DataRecordName = "data"

	// Json format
	MessageJsonFormat = "json"
	// Metro format
	MessageMetroFormat = "metro"
)

Variables

View Source
var (
	// ErrInvalidMetroFile is given when there's an invalid file
	ErrInvalidMetroFile = errors.New("the file isn't metro file")
	// ErrNonHeaderRecord is given when there isn't header record
	ErrNonHeaderRecord = errors.New("the file must have header record")
)

Functions

func IsMetroFile

func IsMetroFile(s string) bool

Metro file check

func IsPacked added in v0.3.2

func IsPacked(s string) bool

IsPacked packed format check

func IsVariableLength

func IsVariableLength(s string) bool

Variable block check

func NewErrApplicableSegment

func NewErrApplicableSegment(recordName, segName string) error

NewErrApplicableSegment returns a error that can't support applicable segment

func NewErrBlockDescriptorWord

func NewErrBlockDescriptorWord() error

NewErrBlockDescriptorWord returns a error that

func NewErrFailedParsing added in v0.3.0

func NewErrFailedParsing() error

NewErrFailedParsing returns a error that is failed parsing raw data

func NewErrFieldRequired added in v0.3.0

func NewErrFieldRequired(fieldName, recordName string) error

NewErrFieldRequired is given when a field is required

func NewErrInvalidRecord added in v0.3.0

func NewErrInvalidRecord(name string) error

NewErrInvalidRecord returns a error if is invalid record

func NewErrInvalidSegment added in v0.3.0

func NewErrInvalidSegment(name string) error

NewErrInvalidSegment returns a error that has invalid segment

func NewErrInvalidValueOfField added in v0.3.0

func NewErrInvalidValueOfField(fieldName, recordName string) error

NewErrInvalidValueOfField returns a error that has invalid value

func NewErrNonAlphanumeric added in v0.3.0

func NewErrNonAlphanumeric(fieldName, recordName string) error

NewErrNonAlphanumeric is given when a field has non-alphanumeric characters

func NewErrNumeric added in v0.3.0

func NewErrNumeric(fieldName, recordName string) error

NewErrNumeric is given when a field is not numeric characters

func NewErrPhoneNumber added in v0.3.0

func NewErrPhoneNumber(recordName string) error

NewErrPhoneNumber is given when a field is an invalid phone number

func NewErrSegmentLength added in v0.3.0

func NewErrSegmentLength(recordName string) error

NewErrSegmentLength is given when a segment has an invalid length

func NewErrUpperAlpha added in v0.3.0

func NewErrUpperAlpha(fieldName, recordName string) error

NewErrUpperAlpha is given when a field is not in uppercase

func NewErrValidDate added in v0.3.0

func NewErrValidDate(fieldName, recordName string) error

NewErrValidDate is given when there's an invalid date

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