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 ability to append raw message #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,16 @@ func (m *Marshaler) newFieldIndex() int {
return fsLen
}

// AppendRaw appends marshalled protobuf message to mm.
func (mm *MessageMarshaler) AppendRaw(data []byte) {
m := mm.m
dst := m.buf
dstLen := len(dst)
dst = append(dst, data...)
m.buf = dst
mm.appendField(m, dstLen, len(dst))
}

// AppendInt32 appends the given int32 value under the given fieldNum to mm.
func (mm *MessageMarshaler) AppendInt32(fieldNum uint32, i32 int32) {
mm.AppendUint64(fieldNum, uint64(uint32(i32)))
Expand Down