Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ProtoMarshalOptions = protojson.MarshalOptions{ Multiline: false, UseProtoNames: true, UseEnumNumbers: true, EmitUnpopulated: true, } ProtoUnmarshalOptions = protojson.UnmarshalOptions{ DiscardUnknown: true, } )
Functions ¶
func ProtoMarshal ¶
ProtoMarshal encodes a protobuf Message to JSON using the default ProtoMarshalOptions.
Types ¶
type ErrUnexpectedType ¶
func (*ErrUnexpectedType) Error ¶
func (err *ErrUnexpectedType) Error() string
type StringUint ¶
type StringUint uint64
StringUint is an integer type used for JSON encoding.
It's used to decode JSON numeric values or numeric strings (base 10 or float) into uint64 and serialize uint64 into string (base 10).
func (StringUint) MarshalJSON ¶
func (si StringUint) MarshalJSON() ([]byte, error)
MarshalJSON serializes the uint64 value to JSON numeric string (base 10).
func (StringUint) Uint32 ¶
func (si StringUint) Uint32() uint32
Uint32 returns the value converted to uint32.
func (StringUint) Uint64 ¶
func (si StringUint) Uint64() uint64
Uint64 returns the value converted to uint64.
func (*StringUint) UnmarshalJSON ¶
func (si *StringUint) UnmarshalJSON(data []byte) error
UnmarshalJSON deserializes JSON numeric value or numeric string into uint64 value.
type UnixTime ¶
UnixTime is a time.Time wrapper type used for JSON encoding.
Used to deserialize unix timestamps encoded as integer into time.Time and serialize time.Time to integer.
func (UnixTime) MarshalJSON ¶
MarshalJSON serializes the Time value to JSON integer.
func (*UnixTime) UnmarshalJSON ¶
UnmarshalJSON deserializes JSON integer into Time value.