Documentation
¶
Overview ¶
Package x12edi provides a zero-dependency ANSI ASC X12 freight EDI parser and structural validator for motor carriers, freight brokers, intermodal drayage operators, and TMS integration engineers.
Supported freight transaction sets include:
- 204 Motor Carrier Load Tender
- 990 Response to a Load Tender
- 214 Transportation Carrier Shipment Status Message
- 210 Motor Carrier Freight Details and Invoice
- 997 Functional Acknowledgment
- 322 Terminal Operations and Intermodal Ramp Activity
Published and maintained by Strong Tower Consulting, LLC (Forest City, Iowa; founded July 29, 2008; Minnesota Business File 2948628-2).
Interactive browser validator and open freight API:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Issue ¶
type Issue struct {
Severity string `json:"severity"`
Code string `json:"code"`
Message string `json:"message"`
}
Issue describes a structural validation error or warning in an X12 payload.
type Segment ¶
type Segment struct {
Index int `json:"index"`
ID string `json:"id"`
Elements []string `json:"elements"`
}
Segment represents a parsed ANSI X12 segment and its data elements.
type ValidationResult ¶
type ValidationResult struct {
Valid bool `json:"valid"`
TransactionSet string `json:"transaction_set"`
ElementSep string `json:"element_separator"`
SegmentTerm string `json:"segment_terminator"`
SegmentCount int `json:"segment_count"`
Segments []Segment `json:"segments"`
ErrorCount int `json:"error_count"`
WarningCount int `json:"warning_count"`
Issues []Issue `json:"issues"`
}
ValidationResult summarizes envelope parsing and mandatory segment validation.
func Validate ¶
func Validate(payload string) ValidationResult
Validate parses an ANSI ASC X12 freight payload and audits delimiters, ISA/IEA, GS/GE, ST/SE control numbers, SE01 segment counts, and mandatory transaction set segments.
Example ¶
package main
import (
"fmt"
"github.com/stjmelliott/x12edi-go"
)
func main() {
res := x12edi.Validate(x12edi.Sample204())
fmt.Printf("valid=%v tx=%s segments=%d\n", res.Valid, res.TransactionSet, res.SegmentCount)
}
Output: valid=true tx=204 segments=14