Documentation
¶
Index ¶
- Constants
- Variables
- type Buffer
- func (p *Buffer) Bytes() []byte
- func (p *Buffer) DecodeFixed32() (x uint64, err error)
- func (p *Buffer) DecodeFixed64() (x uint64, err error)
- func (p *Buffer) DecodeRawBytes(alloc bool) (buf []byte, err error)
- func (p *Buffer) DecodeStringBytes() (s string, err error)
- func (p *Buffer) DecodeVarint() (x uint64, err error)
- func (p *Buffer) DecodeZigzag32() (x uint64, err error)
- func (p *Buffer) DecodeZigzag64() (x uint64, err error)
- func (p *Buffer) Reset()
- func (p *Buffer) SetBuf(s []byte)
- func (p *Buffer) SetDeterministic(deterministic bool)
- func (p *Buffer) Unmarshal() (ProtobufJSON, bool)
- type ProtobufJSON
- func (p ProtobufJSON) GetTagMessage(tags ...string) []ProtobufJSON
- func (p ProtobufJSON) GetTagValue(wire string, tags ...string) []interface{}
- func (p ProtobufJSON) GetTagValueToInt64(wire string, tags ...string) int64
- func (p ProtobufJSON) GetTagValueToString(tags ...string) string
- func (p ProtobufJSON) SetTagValue(tag string, value interface{})
Constants ¶
const ( WireVarint = 0 WireFixed64 = 1 WireBytes = 2 WireStartGroup = 3 WireEndGroup = 4 WireFixed32 = 5 )
Constants that identify the encoding of a value on the wire.
Variables ¶
var ErrInternalBadWireType = errors.New("proto: internal error: bad wiretype for oneof")
ErrInternalBadWireType is returned by generated code when an incorrect wire type is encountered. It does not get returned to user code.
Functions ¶
This section is empty.
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
func NewBuffer ¶
NewBuffer allocates a new Buffer and initializes its internal data to the contents of the argument slice.
func (*Buffer) DecodeFixed32 ¶
DecodeFixed32 reads a 32-bit integer from the Buffer. This is the format for the fixed32, sfixed32, and float protocol buffer types.
func (*Buffer) DecodeFixed64 ¶
DecodeFixed64 reads a 64-bit integer from the Buffer. This is the format for the fixed64, sfixed64, and double protocol buffer types.
func (*Buffer) DecodeRawBytes ¶
DecodeRawBytes reads a count-delimited byte buffer from the Buffer. This is the format used for the bytes protocol buffer type and for embedded messages.
func (*Buffer) DecodeStringBytes ¶
DecodeStringBytes reads an encoded string from the Buffer. This is the format used for the proto2 string type.
func (*Buffer) DecodeVarint ¶
DecodeVarint reads a varint-encoded integer from the Buffer. This is the format for the int32, int64, uint32, uint64, bool, and enum protocol buffer types.
func (*Buffer) DecodeZigzag32 ¶
DecodeZigzag32 reads a zigzag-encoded 32-bit integer from the Buffer. This is the format used for the sint32 protocol buffer type.
func (*Buffer) DecodeZigzag64 ¶
DecodeZigzag64 reads a zigzag-encoded 64-bit integer from the Buffer. This is the format used for the sint64 protocol buffer type.
func (*Buffer) Reset ¶
func (p *Buffer) Reset()
Reset resets the Buffer, ready for marshaling a new protocol buffer.
func (*Buffer) SetBuf ¶
SetBuf replaces the internal buffer with the slice, ready for unmarshaling the contents of the slice.
func (*Buffer) SetDeterministic ¶
SetDeterministic sets 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.
func (*Buffer) Unmarshal ¶
func (p *Buffer) Unmarshal() (ProtobufJSON, bool)
type ProtobufJSON ¶
type ProtobufJSON map[string]interface{}
func (ProtobufJSON) GetTagMessage ¶
func (p ProtobufJSON) GetTagMessage(tags ...string) []ProtobufJSON
func (ProtobufJSON) GetTagValue ¶
func (p ProtobufJSON) GetTagValue(wire string, tags ...string) []interface{}
func (ProtobufJSON) GetTagValueToInt64 ¶
func (p ProtobufJSON) GetTagValueToInt64(wire string, tags ...string) int64
func (ProtobufJSON) GetTagValueToString ¶
func (p ProtobufJSON) GetTagValueToString(tags ...string) string
func (ProtobufJSON) SetTagValue ¶
func (p ProtobufJSON) SetTagValue(tag string, value interface{})