utils

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

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 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
	ErrRecordLength = 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")
	// ErrEmail is given when a field is not email
	ErrEmail = errors.New("is not email address")
	// ErrPayeeExtBlock is given when payee record has not extension block for  for each type of return
	ErrPayeeExtBlock = errors.New("should exist extension block")
	// ErrInvalidAscii is given when is invalid ascii
	ErrInvalidAscii = errors.New("is invalid ascii")
	// ErrInvalidFile is given when is invalid file
	ErrInvalidFile = errors.New("is invalid file")
	// ErrNonExistPayer is given when isn't payer record
	ErrNonExistPayer = errors.New("should exist payer record")
	// ErrNonExistEndPayer is given when isn't payer record
	ErrNonExistEndPayer = errors.New("should exist end of payer record")
	// ErrNonExistPayee is given when isn't payee record
	ErrNonExistPayee = errors.New("should exist at least one payee record")
	// ErrInvalidNumberPayees is given when has incorrect number of payees
	ErrInvalidNumberPayees = errors.New("has incorrect number of payees")
	// ErrIncorrectReturnIndicator is given when has incorrect return indicator
	ErrIncorrectReturnIndicator = errors.New("has incorrect return indicator")
	// ErrInvalidTotalAmounts is given when have invalid totals of any payment amount fields
	ErrInvalidTotalAmounts = errors.New("have invalid totals of any payment amount fields")
	// ErrUnexpectedPaymentAmount is given when has unexpected payment amount in B records
	ErrUnexpectedPaymentAmount = errors.New("has unexpected payment amount")
	// ErrUnexpectedTotalAmount is given when has unexpected totals of any payment amount in C,K record
	ErrUnexpectedTotalAmount = errors.New("has unexpected totals of any payment amount")
	// ErrInvalidTypeOfReturn is given when has invalid type of return
	ErrInvalidTypeOfReturn = errors.New("has invalid type of return")
	// ErrDuplicatedFSCode is given when has duplicated combined fs code in state records
	ErrDuplicatedFSCode = errors.New("has duplicated combined fs code")
	// ErrInvalidNumberPayers is given when has incorrect number of payers
	ErrInvalidNumberPayers = errors.New("has incorrect number of payers")
	// ErrInvalidTCC is given when is invalid transmitter control code
	ErrInvalidTCC = errors.New("is invalid transmitter control code")
)

Functions

func CopyStruct

func CopyStruct(from interface{}, to interface{})

to copy fields between struct instances

func GetField

func GetField(from interface{}, fieldName string) (reflect.Value, error)

to get field

func NewErrFieldRequired

func NewErrFieldRequired(field string) error

NewErrFieldRequired returns a error that has empty required field

func NewErrRecordSequenceNumber

func NewErrRecordSequenceNumber(field string) error

NewErrRecordSequenceNumber returns a error that has invalid record sequence number

func NewErrUnexpectedRecord

func NewErrUnexpectedRecord(name string, record interface{}) error

NewErrUnexpectedRecord returns a error that has unexpected record

func NewErrValidValue

func NewErrValidValue(field string) error

NewErrValidValue returns a error that has invalid value

func ParseValue

func ParseValue(fields reflect.Value, spec map[string]config.SpecField, record string) error

parse field with string

func ToString

func ToString(elm config.SpecField, data reflect.Value) string

to string from field

func Validate

func Validate(r interface{}, spec map[string]config.SpecField) error

to validate fields of record

Types

This section is empty.

Jump to

Keyboard shortcuts

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