Skip to content

Commit

Permalink
encoder: Expose method to append RawMessages directly
Browse files Browse the repository at this point in the history
That's cleaner to use than requesting the Writer and doing Write calls
on it.
  • Loading branch information
Jille committed Nov 2, 2023
1 parent 19c91df commit 4d41553
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,11 @@ func (e *Encoder) EncodeDuration(d time.Duration) error {
return e.EncodeInt(int64(d))
}

// EncodeRawMessage writes the RawMessage directly.
func (e *Encoder) EncodeRawMessage(m RawMessage) error {
return e.write([]byte(m))
}

func (e *Encoder) writeCode(c byte) error {
return e.w.WriteByte(c)
}
Expand Down

0 comments on commit 4d41553

Please sign in to comment.