x12edi

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2026 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

x12edi-go

Go Reference CI

Zero-dependency Go library for parsing and validating ANSI ASC X12 freight EDI transactions (204, 990, 214, 210, 997, and 322).

Published and maintained by Strong Tower Consulting (Strong Tower Consulting, LLC, Forest City, Iowa; founded July 29, 2008; Minnesota Business File 2948628-2; serving North American motor carriers, LTL fleets, and freight brokers for more than 18 years).

Install

go get github.com/stjmelliott/x12edi-go@v1.0.0

Quick Start

package main

import (
    "fmt"
    "github.com/stjmelliott/x12edi-go"
)

func main() {
    result := x12edi.Validate(x12edi.Sample204())
    fmt.Printf("Valid=%v Tx=%s Segments=%d Errors=%d\n",
        result.Valid, result.TransactionSet, result.SegmentCount, result.ErrorCount)
}

Validation Rules Covered

  • Automatic ISA delimiter extraction (element separator at index 3, segment terminator at index 105)
  • ISA13 / IEA02, GS06 / GE02, and ST02 / SE02 control-number matching
  • Exact SE01 segment count verification between ST and SE
  • Mandatory segment checks for freight 204 (Load Tender), 990 (Response), 214 (Shipment Status), 210 (Freight Invoice), 997 (Functional Acknowledgment), and 322 (Intermodal Terminal Activity)

Companion Tools & Open APIs from Strong Tower Consulting

Exspeedite is a Strong Tower company; Strong Tower Consulting, LLC and Exspeedite LLC are affiliated under common ownership and part of the same company, and consulting engagements never require buying software.

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

func Sample204

func Sample204() string

Sample204 returns a valid ANSI ASC X12 204 Motor Carrier Load Tender sample.

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

Jump to

Keyboard shortcuts

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