Documentation ¶
Overview ¶
Package encoding contains helpers to encode or decode values.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarshalProtoJSON ¶ added in v1.50.0
MarshalProtoJSON encode proto message into JSON.
func UnmarshalProtoJSON ¶ added in v1.50.0
UnmarshalProtoJSON decode JSON into proto message.
Types ¶
type GobInt32 ¶
type GobInt32 int32
GobInt32 can be used as a pointer inside a struct. When serialized with encoding/gob it will differentiate between a nil pointer or a zero, which is not possible with the stdlib.
It helps us for example when transferring XML decoded data to a queue, where we need to encode the value but keep the information of which fields are present and which ones are really zero value.
func NewGobInt32 ¶
NewGobInt32 builds a new instance with the specified value. It is a comodity to build new numbers with a constant without an intermediary variable.