Documentation
¶
Overview ¶
Package x12 implements a parser and encoder for the ANSI X12 EDI format.
It focuses on the 5010 version of the format, but is flexible such that it can be used for other versions as well.
Index ¶
Constants ¶
const ( // SegmentSeparator is the character that separates segments. SegmentSeparator = "~" // ElementSeparator is the character that separates elements. ElementSeparator = "*" // SubElementSeparator is the character that separates sub-elements. SubElementSeparator = ":" )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type DecodeOption ¶
type DecodeOption func(*decodeState)
DecodeOption is a function that can be used to configure the decoder.
func WithRelaxedSegmentIDWhitespace ¶
func WithRelaxedSegmentIDWhitespace() DecodeOption
WithRelaxedSegmentIDWhitespace allows the decoder to accept segment IDs with leading and trailing whitespace.
type FunctionGroup ¶
type FunctionGroup struct { Header *GS Transactions []*Transaction Trailer *GE }
FunctionGroup is a group of transactions.
type GS ¶
type GS struct { FunctionalIDCode string ApplicationSenderCode string ApplicationReceiverCode string Date string Time string GroupControlNumber string ResponsibleAgencyCode string VersionReleaseIndustryID string }
GS is the Functional Group Header.
type ISA ¶
type ISA struct { AuthorizationInfoQualifier string AuthorizationInformation string SecurityInfoQualifier string SecurityInfo string InterchangeSenderIDQualifier string InterchangeSenderID string InterchangeReceiverIDQualifier string InterchangeReceiverID string InterchangeDate string InterchangeTime string InterchangeControlStandardsID string InterchangeControlVersion string InterchangeControlNumber string AcknowledgmentRequested string UsageIndicator string ComponentElementSeparator string }
ISA is the Interchange Control Headera.
type Interchange ¶
type Interchange struct { Header *ISA FunctionGroups []*FunctionGroup Trailer *IEA }
Interchange is the envelope for an X12 interchange.
type Marshaler ¶
type ST ¶
type ST struct { TransactionSetIDCode string TransactionSetControlNumber string ImplementationConventionReference string }
ST is the Transaction Set Header.
type Transaction ¶
Transaction is a single transaction.
type X12Document ¶
type X12Document struct { Interchange *Interchange // EnvelopeAutomaticallyAdded is true if the envelope was automatically added to a decoded document. // This may be the case if the document was decoded from a file that did not contain an ISA/IEA envelope. EnvelopeAutomaticallyAdded bool }
X12Document is the root element of an X12 document.
func Decode ¶
func Decode(in io.Reader, opts ...DecodeOption) (*X12Document, error)
Decode decodes an X12 document from an io.Reader
func (*X12Document) Validate ¶
func (doc *X12Document) Validate() error
Validate validates the x12 document