Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
bin
_vendor
.idea
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ The following features can be generated:

- `func (p *YourProto) MarshalToSizedBufferVTStrict(data []byte) (int, error)`: this function behaves like `MarshalToSizedBufferVT`, except fields are marshalled in a strict order by field's numbers they were declared in .proto file.

- `marshal_stable`: generate the following help methods

- `func (p *YourProto) MarshalVTStable() ([]byte, error)`: this function behaves like `MarshalVT`, except the maps are marshalled with the stable order to provide the deterministic results.

- `func (p *YourProto) MarshalToVTStable(data []byte) (int, error)`: this function behaves like `MarshalToVT`, except the maps are marshalled with the stable order to provide the deterministic results.

- `func (p *YourProto) MarshalToSizedBufferVTStable(data []byte) (int, error)`: this function behaves like `MarshalToSizedBufferVT`, except the maps are marshalled with the stable order to provide the deterministic results.

- `unmarshal`: generates a `func (p *YourProto) UnmarshalVT(data []byte)` that behaves similarly to calling `proto.Unmarshal(data, p)` on the message, except the unmarshalling is performed by unrolled codegen without using reflection and allocating as little memory as possible. If the receiver `p` is **not** fully zeroed-out, the unmarshal call will actually behave like `proto.Merge(data, p)`. This is because the `proto.Unmarshal` in the ProtoBuf API is implemented by resetting the destination message and then calling `proto.Merge` on it. To ensure proper `Unmarshal` semantics, ensure you've called `proto.Reset` on your message before calling `UnmarshalVT`, or that your message has been newly allocated.

Expand Down
Loading