Involved Source Files
Package proto defines the protobuf codec. Importing this package will
register the codec.
Package-Level Type Names (total 2, neither is exported)
/* sort exporteds by: | */
Bufferproto.BufferBuffer.buf[]byteBuffer.deterministicboolBuffer.idxintlastMarshaledSizeuint32
Bytes returns the internal buffer.
DebugPrint dumps the encoded bytes of b with a header and footer including s
to stdout. This is only intended for debugging.
DecodeFixed32 consumes a 32-bit little-endian integer from the buffer.
DecodeFixed64 consumes a 64-bit little-endian integer from the buffer.
DecodeGroup consumes a message group from the buffer.
It assumes that the start group marker has already been consumed and
consumes all bytes until (and including the end group marker).
It does not reset m before unmarshaling.
DecodeMessage consumes a length-prefixed message from the buffer.
It does not reset m before unmarshaling.
DecodeRawBytes consumes a length-prefixed raw bytes from the buffer.
If alloc is specified, it returns a copy the raw bytes
rather than a sub-slice of the buffer.
DecodeStringBytes consumes a length-prefixed raw bytes from the buffer.
It does not validate whether the raw bytes contain valid UTF-8.
DecodeVarint consumes an encoded unsigned varint from the buffer.
DecodeZigzag32 consumes an encoded 32-bit zig-zag varint from the buffer.
DecodeZigzag64 consumes an encoded 64-bit zig-zag varint from the buffer.
EncodeFixed32 appends a 32-bit little-endian integer to the buffer.
EncodeFixed64 appends a 64-bit little-endian integer to the buffer.
EncodeMessage appends a length-prefixed encoded message to the buffer.
EncodeRawBytes appends a length-prefixed raw bytes to the buffer.
EncodeStringBytes appends a length-prefixed raw bytes to the buffer.
It does not validate whether v contains valid UTF-8.
EncodeVarint appends an unsigned varint encoding to the buffer.
EncodeZigzag32 appends a 32-bit zig-zag varint encoding to the buffer.
EncodeZigzag64 appends a 64-bit zig-zag varint encoding to the buffer.
Marshal appends the wire-format encoding of m to the buffer.
Reset clears the internal buffer of all written and unread data.
SetBuf sets buf as the internal buffer,
where the contents of buf are considered the unread portion of the buffer.
SetDeterministic specifies whether to use deterministic serialization.
Deterministic serialization guarantees that for a given binary, equal
messages will always be serialized to the same bytes. This implies:
- Repeated serialization of a message will return the same bytes.
- Different processes of the same binary (which may be executing on
different machines) will serialize equal messages to the same bytes.
Note that the deterministic serialization is NOT canonical across
languages. It is not guaranteed to remain stable over time. It is unstable
across different builds with schema changes due to unknown fields.
Users who need canonical serialization (e.g., persistent storage in a
canonical form, fingerprinting, etc.) should define their own
canonicalization specification and implement their own serializer rather
than relying on this API.
If deterministic serialization is requested, map entries will be sorted
by keys in lexographical order. This is an implementation detail and
subject to change.
Unmarshal parses the wire-format message in the buffer and
places the decoded results in m.
It does not reset m before unmarshaling.
Unread returns the unread portion of the buffer.
func marshal(v interface{}, cb *cachedProtoBuffer) ([]byte, error)
codec is a Codec implementation with protobuf. It is the default codec for gRPC.
( T) Marshal(v interface{}) ([]byte, error)( T) Name() string( T) Unmarshal(data []byte, v interface{}) error
T : google.golang.org/grpc/encoding.Codec
T : google.golang.org/grpc.baseCodec
Package-Level Functions (total 3, none are exported)
Package-Level Constants (only one, which is exported)
Name is the name registered for the proto compressor.
The pages are generated with Goldsv0.3.2-preview. (GOOS=darwin GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.