Documentation ¶
Index ¶
Constants ¶
MaxDurationSeconds the maximum number of seconds (when expressed as nanoseconds) which can fit in an int64. gogoproto encodes google.protobuf.Duration as a time.Duration, which is 64-bit signed integer.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder is a JSON encoder that uses the Amino JSON encoding rules for protobuf messages.
func NewAminoJSON ¶
func NewAminoJSON() Encoder
NewAminoJSON returns a new Encoder capable of serializing protobuf messages to JSON using the Amino JSON encoding rules.
func (Encoder) DefineFieldEncoding ¶
func (enc Encoder) DefineFieldEncoding(name string, encoder FieldEncoder) Encoder
DefineFieldEncoding defines a custom encoding for a protobuf field. The `name` field must match a usage of an (amino.encoding) option in the protobuf message as in the following example. This encoding will be used instead of the default encoding for all usages of the tagged field.
message Balance { repeated cosmos.base.v1beta1.Coin coins = 2 [ (amino.encoding) = "legacy_coins", (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; ... }
func (Encoder) DefineMessageEncoding ¶
func (enc Encoder) DefineMessageEncoding(name string, encoder MessageEncoder) Encoder
DefineMessageEncoding defines a custom encoding for a protobuf message. The `name` field must match a usage of an (amino.message_encoding) option in the protobuf message as in the following example. This encoding will be used instead of the default encoding for all usages of the tagged message.
message ModuleAccount { option (amino.name) = "cosmos-sdk/ModuleAccount"; option (amino.message_encoding) = "module_account"; ... }
type FieldEncoder ¶
FieldEncoder is a function that can encode a protobuf protoreflect.Value to JSON.