health: github.com/kdar/health/hl7 Index | Files

package hl7

import "github.com/kdar/health/hl7"

Index

Package Files

decode.go encoder.go hl7.go lexer.go parser.go

func Marshal Uses

func Marshal(segments []Segment) ([]byte, error)

Marshal converts a slice of Segment structs to a byte array containing an HL7 message in "pipehat" format.

func Unmarshal Uses

func Unmarshal(b []byte) (segments []Segment, err error)

Unmarshal takes the bytes passed and returns the segments of the hl7 message.

type Component Uses

type Component []Data

Component is a type that contains Fields and SubComponents. Usually separated by '^'. e.g. component1^component2

func (*Component) Append Uses

func (c *Component) Append(values ...Data) error

Append appends Data to this Component.

func (Component) Index Uses

func (c Component) Index(index int) (Data, bool)

Index returns the Data at a certain index inside this Component.

func (Component) Len Uses

func (c Component) Len() int

type Composer Uses

type Composer interface {
    Data
    Append(values ...Data) error
}

Composer is an interface that represents a piece of data that is indexable and composable.

type Data Uses

type Data interface {
    Index(index int) (Data, bool)
    Len() int
}

Data is an interface the represents a piece of data that is indexable.

type Decoder Uses

type Decoder struct {
    // contains filtered or unexported fields
}

func NewDecoder Uses

func NewDecoder(r io.Reader) *Decoder

func (*Decoder) Decode Uses

func (d *Decoder) Decode() (segments []Segment, err error)

type Encoder Uses

type Encoder struct {
    Writer io.Writer
    // contains filtered or unexported fields
}

func NewEncoder Uses

func NewEncoder(w io.Writer) *Encoder

NewEncoder creates and initializes an Encoder which will write an encoded HL7 message to the provided io.Writer.

func (*Encoder) Encode Uses

func (e *Encoder) Encode(segments []Segment) (err error)

Encode converts the provided slice of Segments stored in the Encoder to an HL7 "pipehat" encoded message and writes it to the io.Writer set in its Writer field. The Segment slice must contain a valid message header (MSH) segment with fields 1 and 2 populated with the field separator and escape characters; if this segment is not present, Encode will return an error.

type Field Uses

type Field []byte

Field represents a slice of bytes. This is the most basic type in a HL7 message. e.g., in: MSH|^~\&|field|component1^component2 "MSH", "^~\&", "field", "component1", "component2" are all Fields.

func (Field) Index Uses

func (f Field) Index(index int) (Data, bool)

Index just returns itself at index 0.

func (Field) Len Uses

func (f Field) Len() int

func (Field) String Uses

func (f Field) String() string

type Repeated Uses

type Repeated []Data

Repeated is a type that contains Fields, SubComponents, and Components. Usually separated by '~'. e.g. component1a^component2a~component1b^component2b

func (*Repeated) Append Uses

func (r *Repeated) Append(values ...Data) error

Append appends Data to this Repeated.

func (Repeated) Index Uses

func (r Repeated) Index(index int) (Data, bool)

Index returns the Data at a certain index inside this Repeated.

func (Repeated) Len Uses

func (r Repeated) Len() int

type Segment Uses

type Segment []Data

Segment is a type that contains Fields, SubComponents, Components, and Repeated. Usually separated by '|'. e.g. MSH|field1

func (*Segment) Append Uses

func (s *Segment) Append(values ...Data) (err error)

Append appends Data to this Segment.

func (Segment) Index Uses

func (s Segment) Index(index int) (Data, bool)

Index returns the Data at a certain index inside this Segment.

func (Segment) Len Uses

func (s Segment) Len() int

type SubComponent Uses

type SubComponent []Field

SubComponent is a type that contains Fields. Usually separated by '&'. e.g. subcomponent1&subcomponent2

func (*SubComponent) Append Uses

func (s *SubComponent) Append(values ...Data) error

Append appends Data to this SubComponent.

func (SubComponent) Index Uses

func (s SubComponent) Index(index int) (Data, bool)

Index returns the Data at a certain index inside this SubComponent.

func (SubComponent) Len Uses

func (s SubComponent) Len() int

Package hl7 imports 10 packages (graph) and is imported by 2 packages. Updated 2016-07-22. Refresh now. Tools for package owners.