Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added encoder for HL7 messages (pipehat format) #5

Merged
merged 2 commits into from
Mar 14, 2015
Merged

Added encoder for HL7 messages (pipehat format) #5

merged 2 commits into from
Mar 14, 2015

Conversation

pegli
Copy link
Contributor

@pegli pegli commented Mar 12, 2015

Added hl7.Encoder type and hl7.Marshal() function to convert HL7 objects to byte slices. The Encoder is constructed with a slice of hl7.Segment structs, one of which must be a valid message header (MSH)
segment. The delimiter characters are parsed from the MSH segment and used to encode all of the
segments into a []byte.

…cts to byte slices. The Encoder

is constructed with a slice of hl7.Segment structs, one of which must be a valid message header (MSH)
segment.  The delimiter characters are parsed from the MSH segment and used to encode all of the
segments into a []byte.
@kdar
Copy link
Owner

kdar commented Mar 12, 2015

Could you change the API to be like:

func NewEncoder(w io.Writer) *Encoder
func (e *Encoder) Encode(segments []Segment) error

So it more closely matches how the stdlib does it and how hl7 decoding works.

@pegli
Copy link
Contributor Author

pegli commented Mar 12, 2015

No problem! Let me know if you see any other issues with this PR.

kdar added a commit that referenced this pull request Mar 14, 2015
Added encoder for HL7 messages (pipehat format)
@kdar kdar merged commit 9f3d143 into kdar:master Mar 14, 2015
@kdar
Copy link
Owner

kdar commented Mar 14, 2015

Thanks for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants