Documentation
¶
Overview ¶
Package genproto2 generates Go methods that directly encode/decode protobuf3 wire format bytes, without intermediate proto.Message structs. The generated bytes are identical to what amino.MarshalReflect produces.
Index ¶
- type P3Context2
- func (ctx *P3Context2) GenerateProtobuf3ForTypes(pkg string, rtz ...reflect.Type) (string, error)
- func (ctx *P3Context2) WriteProto3Schema(pkg *amino.Package)
- func (ctx *P3Context2) WriteProtobuf3(pkg *amino.Package)
- func (ctx *P3Context2) WriteProtobuf3ForTypes(filename, pkg string, rtz ...reflect.Type) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type P3Context2 ¶
type P3Context2 struct {
// contains filtered or unexported fields
}
P3Context2 holds state for generating protobuf3 direct-encoding methods.
func NewP3Context2 ¶
func NewP3Context2(cdc *amino.Codec) *P3Context2
NewP3Context2 creates a generator context with the given codec.
func (*P3Context2) GenerateProtobuf3ForTypes ¶
GenerateProtobuf3ForTypes generates source text for the given types. pkg is the Go package name for the generated file. The returned string is valid Go source.
func (*P3Context2) WriteProto3Schema ¶
func (ctx *P3Context2) WriteProto3Schema(pkg *amino.Package)
WriteProto3Schema generates the .proto schema file for a package, exactly as genproto.WriteProto3Schema does.
func (*P3Context2) WriteProtobuf3 ¶
func (ctx *P3Context2) WriteProtobuf3(pkg *amino.Package)
WriteProtobuf3 generates pb3_gen.go in the package's directory.
func (*P3Context2) WriteProtobuf3ForTypes ¶
func (ctx *P3Context2) WriteProtobuf3ForTypes(filename, pkg string, rtz ...reflect.Type) error
WriteProtobuf3ForTypes generates and writes source to the given filename.