hl7

package module
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 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 DecodeDataError added in v1.1.2

type DecodeDataError struct {
	Tag   string
	Value string
}

func (*DecodeDataError) Error added in v1.1.2

func (e *DecodeDataError) Error() string

type DecodeOption

type DecodeOption struct {
	ErrorZSegment  bool // Error on an unknown Zxx segment when true.
	HeaderOnly     bool // Only decode first segment, usually the header.
	IgnoreFieldSep bool // Ignore field separator values in text fields.
}

Decode options for the HL7 decoder.

type DecodeSegmentError added in v1.1.2

type DecodeSegmentError struct {
	Line        int
	SegmentName string
	FieldName   string
	FieldType   string
	Ordinal     int32
	Inner       error
}

func (*DecodeSegmentError) Error added in v1.1.2

func (e *DecodeSegmentError) Error() string

func (*DecodeSegmentError) Unwrap added in v1.1.2

func (e *DecodeSegmentError) Unwrap() error

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
}

SegmentError 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.

func (SegmentError) Error added in v1.1.2

func (e SegmentError) Error() string

func (SegmentError) Unwrap added in v1.1.2

func (e SegmentError) Unwrap() []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