Documentation ¶
Overview ¶
TODO AMINO DOCS, for now see the main README file, or the code.
Example ¶
package main import ( "fmt" "reflect" amino "github.com/gnolang/gno/tm2/pkg/amino" ) func main() { type Message interface{} type bcMessage struct { Message string Height int } type bcResponse struct { Status int Message string } type bcStatus struct { Peers int } // amino.RegisterPackage registers globally. amino.RegisterPackage( amino.NewPackage( reflect.TypeOf(bcMessage{}).PkgPath(), "amino_test", amino.GetCallersDirname(), ). WithTypes(&bcMessage{}, &bcResponse{}, &bcStatus{}), ) bm := &bcMessage{Message: "ABC", Height: 100} msg := bm var bz []byte // the marshalled bytes. var err error bz, err = amino.MarshalAnySized(msg) fmt.Printf("Encoded: %X (err: %v)\n", bz, err) var msg2 Message err = amino.UnmarshalSized(bz, &msg2) fmt.Printf("Decoded: %v (err: %v)\n", msg2, err) bm2 := msg2.(*bcMessage) fmt.Printf("Decoded successfully: %v\n", *bm == *bm2) }
Output: Encoded: 210A152F616D696E6F5F746573742E62634D65737361676512080A0341424310C801 (err: <nil>) Decoded: &{ABC 100} (err: <nil>) Decoded successfully: true
Index ¶
- Constants
- Variables
- func ByteSliceSize(bz []byte) int
- func DecodeBool(bz []byte) (b bool, n int, err error)
- func DecodeByte(bz []byte) (b byte, n int, err error)
- func DecodeByteSlice(bz []byte) (bz2 []byte, n int, err error)
- func DecodeDuration(bz []byte) (d time.Duration, n int, err error)
- func DecodeDurationValue(bz []byte) (s int64, ns int32, n int, err error)
- func DecodeFloat32(bz []byte) (f float32, n int, err error)
- func DecodeFloat64(bz []byte) (f float64, n int, err error)
- func DecodeInt32(bz []byte) (i int32, n int, err error)
- func DecodeInt64(bz []byte) (i int64, n int, err error)
- func DecodeJSONDuration(bz []byte, fopts FieldOptions) (d time.Duration, err error)
- func DecodeJSONPBDuration(bz []byte, fopts FieldOptions) (d durationpb.Duration, err error)
- func DecodeJSONPBTimestamp(bz []byte, fopts FieldOptions) (t timestamppb.Timestamp, err error)
- func DecodeJSONTime(bz []byte, fopts FieldOptions) (t time.Time, err error)
- func DecodeString(bz []byte) (s string, n int, err error)
- func DecodeTime(bz []byte) (t time.Time, n int, err error)
- func DecodeTimeValue(bz []byte) (s int64, ns int32, n int, err error)
- func DecodeUint32(bz []byte) (u uint32, n int, err error)
- func DecodeUint64(bz []byte) (u uint64, n int, err error)
- func DecodeUvarint(bz []byte) (u uint64, n int, err error)
- func DecodeUvarint16(bz []byte) (u uint16, n int, err error)
- func DecodeUvarint32(bz []byte) (u uint32, n int, err error)
- func DecodeUvarint8(bz []byte) (u uint8, n int, err error)
- func DecodeVarint(bz []byte) (i int64, n int, err error)
- func DecodeVarint16(bz []byte) (i int16, n int, err error)
- func DecodeVarint8(bz []byte) (i int8, n int, err error)
- func DeepCopy(o interface{}) (r interface{})
- func DeepCopyToPtr(o interface{}) (ptr interface{})
- func DeepEqual(a, b interface{}) bool
- func EncodeBool(w io.Writer, b bool) (err error)
- func EncodeByte(w io.Writer, b byte) (err error)
- func EncodeByteSlice(w io.Writer, bz []byte) (err error)
- func EncodeDuration(w io.Writer, d time.Duration) (err error)
- func EncodeDurationValue(w io.Writer, s int64, ns int32) (err error)
- func EncodeFloat32(w io.Writer, f float32) (err error)
- func EncodeFloat64(w io.Writer, f float64) (err error)
- func EncodeInt32(w io.Writer, i int32) (err error)
- func EncodeInt64(w io.Writer, i int64) (err error)
- func EncodeJSONDuration(w io.Writer, d time.Duration) (err error)
- func EncodeJSONDurationValue(w io.Writer, s int64, ns int32) (err error)
- func EncodeJSONPBDuration(w io.Writer, d *durationpb.Duration) (err error)
- func EncodeJSONPBTimestamp(w io.Writer, t *timestamppb.Timestamp) (err error)
- func EncodeJSONTime(w io.Writer, t time.Time) (err error)
- func EncodeJSONTimeValue(w io.Writer, s int64, ns int32) (err error)
- func EncodeString(w io.Writer, s string) (err error)
- func EncodeTime(w io.Writer, t time.Time) (err error)
- func EncodeTimeValue(w io.Writer, s int64, ns int32) (err error)
- func EncodeUint32(w io.Writer, u uint32) (err error)
- func EncodeUint64(w io.Writer, u uint64) (err error)
- func EncodeUvarint(w io.Writer, u uint64) (err error)
- func EncodeUvarint16(w io.Writer, i uint16) (err error)
- func EncodeUvarint32(w io.Writer, i uint32) (err error)
- func EncodeUvarint8(w io.Writer, i uint8) (err error)
- func EncodeVarint(w io.Writer, i int64) (err error)
- func EncodeVarint16(w io.Writer, i int16) (err error)
- func EncodeVarint32(w io.Writer, i int32) (err error)
- func EncodeVarint8(w io.Writer, i int8) (err error)
- func GetCallersDirname() string
- func GetTypeURL(o interface{}) string
- func IsASCIIText(s string) bool
- func IsEmpty(o interface{}) bool
- func IsEmptyTime(t time.Time) bool
- func IsTypedNil(o interface{}) bool
- func Marshal(o interface{}) ([]byte, error)
- func MarshalAny(o interface{}) ([]byte, error)
- func MarshalAnySized(o interface{}) ([]byte, error)
- func MarshalAnySizedWriter(w io.Writer, o interface{}) (n int64, err error)
- func MarshalJSON(o interface{}) ([]byte, error)
- func MarshalJSONAny(o interface{}) ([]byte, error)
- func MarshalJSONIndent(o interface{}, prefix, indent string) ([]byte, error)
- func MarshalSized(o interface{}) ([]byte, error)
- func MarshalSizedWriter(w io.Writer, o interface{}) (n int64, err error)
- func MustMarshal(o interface{}) []byte
- func MustMarshalAny(o interface{}) []byte
- func MustMarshalAnySized(o interface{}) []byte
- func MustMarshalJSON(o interface{}) []byte
- func MustMarshalJSONAny(o interface{}) []byte
- func MustMarshalSized(o interface{}) []byte
- func MustUnmarshal(bz []byte, ptr interface{})
- func MustUnmarshalAny(bz []byte, ptr interface{})
- func MustUnmarshalJSON(bz []byte, ptr interface{})
- func MustUnmarshalSized(bz []byte, ptr interface{})
- func Unmarshal(bz []byte, ptr interface{}) error
- func UnmarshalAny(bz []byte, ptr interface{}) error
- func UnmarshalAny2(typeURL string, value []byte, ptr interface{}) error
- func UnmarshalAnySized(bz []byte, ptr interface{}) error
- func UnmarshalJSON(bz []byte, ptr interface{}) error
- func UnmarshalSized(bz []byte, ptr interface{}) error
- func UnmarshalSizedReader(r io.Reader, ptr interface{}, maxSize int64) (n int64, err error)
- func UvarintSize(u uint64) int
- func VarintSize(i int64) int
- type Codec
- func (cdc *Codec) Autoseal() *Codec
- func (cdc *Codec) GetPackages() pkg.PackageSet
- func (cdc *Codec) GetTypeInfo(rt reflect.Type) (info *TypeInfo, err error)
- func (cdc *Codec) GetTypeURL(o interface{}) string
- func (cdc *Codec) JSONMarshal(o interface{}) ([]byte, error)
- func (cdc *Codec) JSONUnmarshal(bz []byte, ptr interface{}) error
- func (cdc *Codec) Marshal(o interface{}) ([]byte, error)
- func (cdc *Codec) MarshalAny(o interface{}) ([]byte, error)
- func (cdc *Codec) MarshalAnySized(o interface{}) ([]byte, error)
- func (cdc *Codec) MarshalAnySizedWriter(w io.Writer, o interface{}) (n int64, err error)
- func (cdc *Codec) MarshalJSONAny(o interface{}) ([]byte, error)
- func (cdc *Codec) MarshalJSONIndent(o interface{}, prefix, indent string) ([]byte, error)
- func (cdc *Codec) MarshalPBBindings(pbm PBMessager) ([]byte, error)
- func (cdc *Codec) MarshalReflect(o interface{}) ([]byte, error)
- func (cdc *Codec) MarshalSized(o interface{}) ([]byte, error)
- func (cdc *Codec) MarshalSizedWriter(w io.Writer, o interface{}) (n int64, err error)
- func (cdc *Codec) MustMarshal(o interface{}) []byte
- func (cdc *Codec) MustMarshalAny(o interface{}) []byte
- func (cdc *Codec) MustMarshalAnySized(o interface{}) []byte
- func (cdc *Codec) MustMarshalJSON(o interface{}) []byte
- func (cdc *Codec) MustMarshalJSONAny(o interface{}) []byte
- func (cdc *Codec) MustMarshalSized(o interface{}) []byte
- func (cdc *Codec) MustUnmarshal(bz []byte, ptr interface{})
- func (cdc *Codec) MustUnmarshalAny(bz []byte, ptr interface{})
- func (cdc *Codec) MustUnmarshalJSON(bz []byte, ptr interface{})
- func (cdc *Codec) MustUnmarshalSized(bz []byte, ptr interface{})
- func (cdc *Codec) PrintTypes(out io.Writer) error
- func (cdc *Codec) RegisterPackage(pkg *Package)
- func (cdc *Codec) RegisterTypeFrom(rt reflect.Type, pkg *Package)
- func (cdc *Codec) Seal() *Codec
- func (cdc *Codec) Unmarshal(bz []byte, ptr interface{}) error
- func (cdc *Codec) UnmarshalAny(bz []byte, ptr interface{}) (err error)
- func (cdc *Codec) UnmarshalAny2(typeURL string, value []byte, ptr interface{}) (err error)
- func (cdc *Codec) UnmarshalAnySized(bz []byte, ptr interface{}) error
- func (cdc *Codec) UnmarshalSized(bz []byte, ptr interface{}) error
- func (cdc *Codec) UnmarshalSizedReader(r io.Reader, ptr interface{}, maxSize int64) (n int64, err error)
- func (cdc *Codec) WithPBBindings() *Codec
- type ConcreteInfo
- type FieldInfo
- type FieldOptions
- type InterfaceInfo
- type InvalidDurationError
- type InvalidTimeError
- type Object
- type PBMessager
- type Package
- type StructInfo
- type Typ3
- type Type
- type TypeInfo
Examples ¶
Constants ¶
const ( // Typ3 types Typ3Varint = Typ3(0) Typ38Byte = Typ3(1) Typ3ByteLength = Typ3(2) // Typ3_Struct = Typ3(3) // Typ3_StructTerm = Typ3(4) Typ34Byte = Typ3(5) )
const Version = "1.0.0-rc.10"
Version
Variables ¶
var ( // ErrNoPointer is thrown when you call a method that expects a pointer, e.g. Unmarshal ErrNoPointer = errors.New("expected a pointer") )
Functions ¶
func ByteSliceSize ¶
func DecodeDurationValue ¶
func DecodeJSONDuration ¶
func DecodeJSONDuration(bz []byte, fopts FieldOptions) (d time.Duration, err error)
func DecodeJSONPBDuration ¶
func DecodeJSONPBDuration(bz []byte, fopts FieldOptions) (d durationpb.Duration, err error)
func DecodeJSONPBTimestamp ¶
func DecodeJSONPBTimestamp(bz []byte, fopts FieldOptions) (t timestamppb.Timestamp, err error)
func DecodeJSONTime ¶
func DecodeJSONTime(bz []byte, fopts FieldOptions) (t time.Time, err error)
func DecodeTimeValue ¶
DecodeTimeValue decodes seconds (int64) and nanoseconds (int32) since January 1, 1970 UTC, and returns the corresponding time. If nanoseconds is not in the range [0, 999999999], or if seconds is too large, an error is returned.
func DeepCopy ¶
func DeepCopy(o interface{}) (r interface{})
Deeply copies an object. If anything implements `.DeepCopy() <any>` along the way, the result of that function will be used. Otherwise, if it implements `.MarshalAmino() (<any>, error)` and `.UnmarshalAmino(<any>) error`, the pair will be used to copy. If .MarshalAmino() or .UnmarshalAmino() returns an error, this function will panic.
func DeepCopyToPtr ¶
func DeepCopyToPtr(o interface{}) (ptr interface{})
Like DeepCopy, but returns a pointer to the copy.
func DeepEqual ¶
func DeepEqual(a, b interface{}) bool
DeepEqual returns true if the types are the same and the binary amino encoding would be the same. TODO: optimize, and support genproto.
func EncodeByte ¶
Unlike EncodeUint8, writes a single byte.
func EncodeDurationValue ¶
The binary encoding of Duration is the same as Timestamp, but the validation checks are different.
See https://godoc.org/google.golang.org/protobuf/types/known/durationpb#Duration
type Duration struct {
// Signed seconds of the span of time. Must be from -315,576,000,000 // to +315,576,000,000 inclusive. Note: these bounds are computed from: // 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"` // Signed fractions of a second at nanosecond resolution of the span // of time. Durations less than one second are represented with a 0 // `seconds` field and a positive or negative `nanos` field. For durations // of one second or more, a non-zero value for the `nanos` field must be // of the same sign as the `seconds` field. Must be from -999,999,999 // to +999,999,999 inclusive. Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` // contains filtered or unexported fields }
func EncodeJSONDurationValue ¶
func EncodeJSONPBDuration ¶
func EncodeJSONPBDuration(w io.Writer, d *durationpb.Duration) (err error)
func EncodeJSONPBTimestamp ¶
func EncodeJSONPBTimestamp(w io.Writer, t *timestamppb.Timestamp) (err error)
func EncodeTimeValue ¶
EncodeTimeValue writes the number of seconds (int64) and nanoseconds (int32), with millisecond resolution since January 1, 1970 UTC to the Writer as an UInt64. Milliseconds are used to ease compatibility with Javascript, which does not support finer resolution.
See https://godoc.org/google.golang.org/protobuf/types/known/timestamppb#Timestamp
type Timestamp struct {
// Represents seconds of UTC time since Unix epoch // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to // 9999-12-31T23:59:59Z inclusive. Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"` // Non-negative fractions of a second at nanosecond resolution. Negative // second values with fractions must still have non-negative nanos values // that count forward in time. Must be from 0 to 999,999,999 // inclusive. Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` // contains filtered or unexported fields }
func IsASCIIText ¶
Returns true if s is a non-empty printable non-tab ascii character.
func IsEmptyTime ¶
func IsTypedNil ¶
func IsTypedNil(o interface{}) bool
Go lacks a simple and safe way to see if something is a typed nil. See:
func MarshalAny ¶
func MarshalAnySized ¶
func MarshalAnySizedWriter ¶
func MarshalJSON ¶
func MarshalJSONAny ¶
func MarshalJSONIndent ¶
func MarshalSized ¶
func MustMarshal ¶
func MustMarshal(o interface{}) []byte
func MustMarshalAny ¶
func MustMarshalAny(o interface{}) []byte
func MustMarshalAnySized ¶
func MustMarshalAnySized(o interface{}) []byte
func MustMarshalJSON ¶
func MustMarshalJSON(o interface{}) []byte
func MustMarshalJSONAny ¶
func MustMarshalJSONAny(o interface{}) []byte
func MustMarshalSized ¶
func MustMarshalSized(o interface{}) []byte
func MustUnmarshal ¶
func MustUnmarshal(bz []byte, ptr interface{})
func MustUnmarshalAny ¶
func MustUnmarshalAny(bz []byte, ptr interface{})
func MustUnmarshalJSON ¶
func MustUnmarshalJSON(bz []byte, ptr interface{})
func MustUnmarshalSized ¶
func MustUnmarshalSized(bz []byte, ptr interface{})
func UnmarshalAny ¶
func UnmarshalAny2 ¶
func UnmarshalAnySized ¶
func UnmarshalJSON ¶
func UnmarshalSized ¶
func UnmarshalSizedReader ¶
func UvarintSize ¶
func VarintSize ¶
Types ¶
type Codec ¶
type Codec struct {
// contains filtered or unexported fields
}
func (*Codec) GetPackages ¶
func (cdc *Codec) GetPackages() pkg.PackageSet
XXX TODO: make this safe so modifications don't affect runtime codec, and ensure that it stays safe. NOTE: do not modify the returned Packages.
func (*Codec) GetTypeInfo ¶
This is used primarily for gengo. XXX TODO: make this safe so modifications don't affect runtime codec, and ensure that it stays safe. NOTE: do not modify the returned TypeInfo.
func (*Codec) GetTypeURL ¶
TODO: this does need the cdc receiver, as it should also work for non-pbbindings-optimized types. Returns the default type url for the given concrete type. NOTE: It must be fast, as it is used in pbbindings. XXX Unstable API.
func (*Codec) JSONMarshal ¶
func (*Codec) JSONUnmarshal ¶
func (*Codec) Marshal ¶
Marshal encodes the object o according to the Amino spec. Marshal doesn't prefix the byte-length of the encoding, so the caller must handle framing. Type information as in google.protobuf.Any isn't included, so manually wrap before calling if you need to decode into an interface. NOTE: nil-struct-pointers have no encoding. In the context of a struct, the absence of a field does denote a nil-struct-pointer, but in general this is not the case, so unlike MarshalJSON.
func (*Codec) MarshalAny ¶
MarshalAny encodes the registered object wrapped with google.protobuf.Any.
func (*Codec) MarshalAnySized ¶
func (*Codec) MarshalAnySizedWriter ¶
func (*Codec) MarshalJSONAny ¶
func (*Codec) MarshalJSONIndent ¶
MarshalJSONIndent calls json.Indent on the output of cdc.MarshalJSON using the given prefix and indent string.
func (*Codec) MarshalPBBindings ¶
func (cdc *Codec) MarshalPBBindings(pbm PBMessager) ([]byte, error)
Use pbbindings.
func (*Codec) MarshalReflect ¶
Use reflection.
func (*Codec) MarshalSized ¶
MarshalSized encodes the object o according to the Amino spec, but prefixed by a uvarint encoding of the object to encode. Use Marshal if you don't want byte-length prefixing.
For consistency, MarshalSized will first dereference pointers before encoding. MarshalSized will panic if o is a nil-pointer, or if o is invalid.
func (*Codec) MarshalSizedWriter ¶
MarshalSizedWriter writes the bytes as would be returned from MarshalSized to the writer w.
func (*Codec) MustMarshalAny ¶
Panics if error.
func (*Codec) MustMarshalAnySized ¶
func (*Codec) MustMarshalJSON ¶
MustMarshalJSON panics if an error occurs. Besides tha behaves exactly like MarshalJSON.
func (*Codec) MustMarshalJSONAny ¶
MustMarshalJSONAny panics if an error occurs. Besides tha behaves exactly like MarshalJSONAny.
func (*Codec) MustMarshalSized ¶
Panics if error.
func (*Codec) MustUnmarshal ¶
Panics if error.
func (*Codec) MustUnmarshalAny ¶
func (*Codec) MustUnmarshalJSON ¶
MustUnmarshalJSON panics if an error occurs. Besides tha behaves exactly like UnmarshalJSON.
func (*Codec) MustUnmarshalSized ¶
Panics if error.
func (*Codec) PrintTypes ¶
PrintTypes writes all registered types in a markdown-style table. The table's header is:
| Type | TypeURL | Notes |
Where Type is the golang type name and TypeURL is the type_url the type was registered with.
func (*Codec) RegisterPackage ¶
The package isn't (yet) necessary besides to get the full name of concrete types. Registers all dependencies of pkg recursively. This operation is idempotent -- pkgs already registered may be registered again.
func (*Codec) RegisterTypeFrom ¶
This function should be used to register concrete types that will appear in interface fields/elements to be encoded/decoded by go-amino. You may want to use RegisterPackage() instead which registers everything in a package. Usage: `amino.RegisterTypeFrom(MyStruct1{}, "/tm.cryp.MyStruct1")`
func (*Codec) UnmarshalAny ¶
UnmarshalAny decodes the registered object from an Any.
func (*Codec) UnmarshalAny2 ¶
like UnmarshalAny() but with typeURL and value destructured.
func (*Codec) UnmarshalAnySized ¶
Like UnmarshalAny, but will first decode the byte-length prefix.
func (*Codec) UnmarshalSized ¶
Like Unmarshal, but will first decode the byte-length prefix. UnmarshalSized will panic if ptr is a nil-pointer. Returns an error if not all of bz is consumed.
func (*Codec) UnmarshalSizedReader ¶
func (cdc *Codec) UnmarshalSizedReader(r io.Reader, ptr interface{}, maxSize int64, ) (n int64, err error)
Like Unmarshal, but will first read the byte-length prefix. UnmarshalSizedReader will panic if ptr is a nil-pointer. If maxSize is 0, there is no limit (not recommended).
func (*Codec) WithPBBindings ¶
Returns a new codec that is optimized w/ pbbindings. The returned codec is sealed, but may be affected by modifications to the underlying codec.
type ConcreteInfo ¶
type ConcreteInfo struct { Registered bool // Registered with Register*(). Name string // Registered name which may override default reflection name. PointerPreferred bool // Deserialize to pointer type if possible. TypeURL string // <domain and path>/<p3 package no slashes>.<Name> IsAminoMarshaler bool // Implements MarshalAmino() (<ReprObject>, error) and UnmarshalAmino(<ReprObject>) (error). ReprType *TypeInfo // <ReprType> if IsAminoMarshaler, that, or by default the identity Type. IsJSONValueType bool // If true, the Any representation uses the "value" field (instead of embedding @type). IsBinaryWellKnownType bool // If true, use built-in functions to encode/decode. IsJSONWellKnownType bool // If true, use built-in functions to encode/decode. IsJSONAnyValueType bool // If true, the interface/Any representation uses the "value" field. Elem *TypeInfo // Set if Type.Kind() is Slice or Array. ElemIsPtr bool // Set true iff Type.Elem().Kind() is Pointer. }
type FieldInfo ¶
type FieldInfo struct { Type reflect.Type // Struct field reflect.Type. TypeInfo *TypeInfo // Dereferenced struct field TypeInfo Name string // Struct field name Index int // Struct field index ZeroValue reflect.Value // Could be nil pointer unlike TypeInfo.ZeroValue. UnpackedList bool // True iff this field should be encoded as an unpacked list. FieldOptions // Encoding options }
func (*FieldInfo) ValidateBasic ¶
func (finfo *FieldInfo) ValidateBasic()
type FieldOptions ¶
type FieldOptions struct { JSONName string // (JSON) field name JSONOmitEmpty bool // (JSON) omitempty BinFixed64 bool // (Binary) Encode as fixed64 BinFixed32 bool // (Binary) Encode as fixed32 BinFieldNum uint32 // (Binary) max 1<<29-1 Unsafe bool // e.g. if this field is a float. WriteEmpty bool // write empty structs and lists (default false except for pointers) NilElements bool // Empty list elements are decoded as nil iff set, otherwise are never nil. UseGoogleTypes bool // If true, decodes Any timestamp and duration to google types. }
type InterfaceInfo ¶
type InterfaceInfo struct{}
type InvalidDurationError ¶
type InvalidDurationError string
func (InvalidDurationError) Error ¶
func (e InvalidDurationError) Error() string
type InvalidTimeError ¶
type InvalidTimeError string
func (InvalidTimeError) Error ¶
func (e InvalidTimeError) Error() string
type Object ¶
type Object interface {
GetTypeURL() string
}
All concrete types must implement the Object interface for genproto bindings. They are generated automatically by genproto/bindings.go
type PBMessager ¶
type PBMessager interface { ToPBMessage(*Codec) (proto.Message, error) EmptyPBMessage(*Codec) proto.Message FromPBMessage(*Codec, proto.Message) error }
Methods generated by genproto/bindings.go for faster encoding.
type Package ¶
Package "pkg" exists So dependencies can create Packages. We export it here so this amino package can use it natively.
func RegisterPackage ¶
NOTE: do not modify the result.
type StructInfo ¶
type StructInfo struct {
Fields []FieldInfo // If a struct.
}
type Type ¶
Package "pkg" exists So dependencies can create Packages. We export it here so this amino package can use it natively.
type TypeInfo ¶
type TypeInfo struct { Type reflect.Type // never a pointer kind. Package *Package // package associated with Type. PtrToType reflect.Type ZeroValue reflect.Value InterfaceInfo ConcreteInfo StructInfo }
func (*TypeInfo) GetTyp3 ¶
func (info *TypeInfo) GetTyp3(fopts FieldOptions) Typ3
func (*TypeInfo) GetUltimateElem ¶
If this is a slice or array, get .Elem.ReprType until no longer slice or array.
func (*TypeInfo) IsStructOrUnpacked ¶
func (info *TypeInfo) IsStructOrUnpacked(fopt FieldOptions) bool
Used to determine whether to create an implicit struct or not. Notice that the binary encoding of a list to be unpacked is indistinguishable from a struct that contains that list. NOTE: we expect info.Elem to be prepopulated, constructed within the scope of a Codec.