-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Labels
Milestone
Description
cosmos_proto.scalarproto option that appliesstringandbytestypes- Mapping YAML config file between scalars (language agnostic) and golang types
Ex:
scalars:
cosmos.Int: github.com/cosmos/cosmos-sdk/types.Int- define
CustomTypegolang interface that all golang scalar type implementations need to implement (ex.Int), this is what we're using for gogo proto and can maybe reuse:
type CustomType interface {
Marshal() ([]byte, error)
MarshalTo(data []byte) (n int, err error)
Unmarshal(data []byte) error
Size() int
MarshalJSON() ([]byte, error)
UnmarshalJSON(data []byte) error
}An alternative that just deals with string and bytes types could be:
type CustomStringType interface {
MarshalString() (string, error)
UnmarshalString(string) error
}
type CustomBytesTypes interface {
MarshalBytes() ([]byte, error)
UnmarshalBytes([]byte) error
}Depending on whether cosmos_proto.scalar is used on a string or bytes type, the corresponding interface would be used.
- generate
protoreflect.Messagehandling - generate fast marshaling handling