Skip to content

flume/gox12

This branch is 1 commit ahead of azoner/gox12:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

06aeb10 · Feb 2, 2022

History

84 Commits
Jul 28, 2013
Feb 17, 2014
Jul 25, 2013
Feb 19, 2014
Jul 31, 2013
Feb 16, 2014
Feb 16, 2014
Feb 22, 2014
Feb 2, 2022
Sep 6, 2013
Nov 6, 2014
Nov 6, 2014
Aug 12, 2013
Aug 12, 2013

Repository files navigation

gox12

golang X12 non-validating parser

Build Status

Installation

go get github.com/azoner/gox12

Example

package main

import (
        "fmt"
        "os"
        "log"
        "github.com/azoner/gox12"
)

func main() {
        inFilename := "x12file.txt"
        inFile, err := os.Open(inFilename)
        if err != nil {
                log.Fatal(err)
                os.Exit(1)
        }
        defer inFile.Close()
        raw, err := gox12.NewRawX12FileReader(inFile)
        if err != nil {
                fmt.Println(err)
        }
        for rs := range raw.GetSegments() {
                if rs.Segment.SegmentId == "INS" {
                        fmt.Println(rs)
                        v, _, _ := rs.Segment.GetValue("INS01")
                        fmt.Println(v)
                        for v := range rs.Segment.GetAllValues() {
                                fmt.Println(v.X12Path, v.Value)
                        }
                        fmt.Println()
                }
        }
}

Packages

No packages published

Languages

  • Go 100.0%