hl7

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: BSD-3-Clause Imports: 8 Imported by: 0

README

HL7 v2 - Marshal and Unmarshal

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DecodeOption

type DecodeOption struct {
	ErrorZSegment bool // Error on an unknown Zxx segment when true.
	HeaderOnly    bool // Only decode first segment, usually the header.
}

Decode options for the HL7 decoder.

type Decoder

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

Decode bytes into HL7 structures.

func NewDecoder

func NewDecoder(registry Registry, opt *DecodeOption) *Decoder

Create a new Decoder. A registry must be provided. Option is optional.

func (*Decoder) Decode

func (d *Decoder) Decode(data []byte) (any, error)

Decode takes an hl7 message and returns a final trigger with all segments grouped.

func (*Decoder) DecodeGroup

func (d *Decoder) DecodeGroup(list []any) (any, error)

Group a list of elements into trigger groupings. A value and error may be present at the same time.

func (*Decoder) DecodeList

func (d *Decoder) DecodeList(data []byte) ([]any, error)

Decode returns a list of segments without any grouping applied.

type EncodeOption

type EncodeOption struct {
	TrimTrailingSeparator bool
}

Encoding options.

type Encoder

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

func NewEncoder

func NewEncoder(opt *EncodeOption) *Encoder

Create a new Encoder. Options may be nil.

func (*Encoder) Encode

func (e *Encoder) Encode(message any) ([]byte, error)

type Registry

type Registry interface {
	Version() string
	ControlSegment(string) (any, bool)
	Segment(string) (any, bool)
	Trigger(string) (any, bool)
	DataType(string) (any, bool)
}

type RegistryLookup

type RegistryLookup = map[string]any

type SegmentError added in v1.1.0

type SegmentError struct {
	ErrorList []error
	Segment   any
}

SgmentError may be returned as part of the DecodeList result. This allows a single segment to be decoded poorly with error, while still decoding the rest of the message. This will not be returned as an error.

type Varies added in v1.0.9

type Varies interface {
	ChildVaries(reg func(string) (any, bool)) (reflect.Value, error)
}

Varies should be implemented on a segment that knows how to decode a child VARIES data type.

Directories

Path Synopsis
Package h210 contains the data structures for HL7 v2.1.
Package h210 contains the data structures for HL7 v2.1.
Package h220 contains the data structures for HL7 v2.2.
Package h220 contains the data structures for HL7 v2.2.
Package h230 contains the data structures for HL7 v2.3.
Package h230 contains the data structures for HL7 v2.3.
Package h231 contains the data structures for HL7 v2.3.1.
Package h231 contains the data structures for HL7 v2.3.1.
Package h240 contains the data structures for HL7 v2.4.
Package h240 contains the data structures for HL7 v2.4.
Package h250 contains the data structures for HL7 v2.5.
Package h250 contains the data structures for HL7 v2.5.
Package h251 contains the data structures for HL7 v2.5.1.
Package h251 contains the data structures for HL7 v2.5.1.
Package h260 contains the data structures for HL7 v2.6.
Package h260 contains the data structures for HL7 v2.6.
Package h270 contains the data structures for HL7 v2.7.
Package h270 contains the data structures for HL7 v2.7.
Package h271 contains the data structures for HL7 v2.7.1.
Package h271 contains the data structures for HL7 v2.7.1.
Package h280 contains the data structures for HL7 v2.8.
Package h280 contains the data structures for HL7 v2.8.

Jump to

Keyboard shortcuts

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