hl7: fknsrs.biz/p/hl7 Index | Examples | Files

package hl7

import "fknsrs.biz/p/hl7"

Index

Examples

Package Files

common.go message.go messageparser.go queryparser.go terser.go

type Component Uses

type Component []Subcomponent

type Delimiters Uses

type Delimiters struct {
    Field, Component, Repeat, Escape, Subcomponent byte
}

type ErrInvalidHeader Uses

type ErrInvalidHeader error

ErrInvalidHeader is returned if a message doesn't start with "MSH", or the header isn't exactly the correct length, or any of the control characters aren't unique

type ErrInvalidQuery Uses

type ErrInvalidQuery error

type ErrTooShort Uses

type ErrTooShort error

ErrTooShort is returned if a message isn't long enough to contain a valid header

type Field Uses

type Field []FieldItem

type FieldItem Uses

type FieldItem []Component

type Message Uses

type Message []Segment

func ParseMessage Uses

func ParseMessage(buf []byte) (Message, *Delimiters, error)

ParseMessage takes input as a `[]byte`, and returns the whole message, the control characters (as `*Delimiters`), and maybe an error.

func (Message) Query Uses

func (m Message) Query(s string) (res string, ok bool, err error)

func (Message) Segment Uses

func (m Message) Segment(name string, index int) Segment

func (Message) Segments Uses

func (m Message) Segments(name string) []Segment

type Query Uses

type Query struct {
    Segment          string
    HasSegmentOffset bool
    SegmentOffset    int
    HasField         bool
    Field            int
    HasFieldOffset   bool
    FieldOffset      int
    HasComponent     bool
    Component        int
    HasSubComponent  bool
    SubComponent     int
}

func New Uses

func New(segment string, segmentOffset, field, fieldOffset, component, subComponent int) Query

func ParseQuery Uses

func ParseQuery(s string) (*Query, error)

func (Query) Count Uses

func (q Query) Count(m Message) int

func (Query) Get Uses

func (q Query) Get(m Message) (string, bool)

func (Query) GetString Uses

func (q Query) GetString(m Message) string

Code:

m, _, _ := ParseMessage([]byte(longTestMessageContent))

msh9_1, _ := ParseQuery("MSH-9-1")
msh9_2, _ := ParseQuery("MSH-9-2")

fmt.Printf("%s_%s", msh9_1.GetString(m), msh9_2.GetString(m))

Output:

ORU_R01

func (Query) String Uses

func (q Query) String() string

type Segment Uses

type Segment []Field

type Subcomponent Uses

type Subcomponent string

Package hl7 imports 3 packages (graph). Updated 2018-02-02. Refresh now. Tools for package owners.