Documentation
¶
Overview ¶
Package registry indexes generated protobuf-go-lite message constructors and their statically generated custom options.
Index ¶
- Variables
- func NewByName(name string) (protobuf_go_lite.Message, bool)
- func NewByTypeURL(url string) (protobuf_go_lite.Message, bool)
- func Range(fn func(Entry) bool)
- func Register(e Entry)
- type Entry
- type Option
- type Registry
- func (r *Registry) All() []Entry
- func (r *Registry) FindMessageByURL(url string) (func() protobuf_go_lite.Message, error)
- func (r *Registry) NewByName(name string) (protobuf_go_lite.Message, bool)
- func (r *Registry) NewByTypeURL(url string) (protobuf_go_lite.Message, bool)
- func (r *Registry) Range(fn func(Entry) bool)
- func (r *Registry) Register(e Entry)
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = anypb_resolver.ErrNotFound
ErrNotFound is returned when a message type is not registered.
Functions ¶
func NewByName ¶
func NewByName(name string) (protobuf_go_lite.Message, bool)
NewByName constructs a message from the default registry by full name.
func NewByTypeURL ¶
func NewByTypeURL(url string) (protobuf_go_lite.Message, bool)
NewByTypeURL constructs a message from the default registry by type URL.
Types ¶
type Entry ¶
type Entry struct {
// FullName is the fully qualified protobuf message name.
FullName string
// TypeURL is the canonical google.protobuf.Any type URL.
TypeURL string
// New constructs an empty message.
New func() protobuf_go_lite.Message
// Options contains the message's flattened custom options.
Options []Option
}
Entry describes one generated protobuf message type.
type Option ¶
type Option struct {
// Name is the fully qualified option name followed by its message field path.
Name string
// Values contains repeated values in declaration order.
Values []string
}
Option contains the flattened values of one custom message option.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry indexes message constructors by full name and type URL.
func Default ¶
func Default() *Registry
Default returns the registry populated by generated init functions.
func (*Registry) FindMessageByURL ¶
func (r *Registry) FindMessageByURL(url string) (func() protobuf_go_lite.Message, error)
FindMessageByURL returns the constructor named by url.
func (*Registry) NewByName ¶
func (r *Registry) NewByName(name string) (protobuf_go_lite.Message, bool)
NewByName constructs the message registered under its full protobuf name.
func (*Registry) NewByTypeURL ¶
func (r *Registry) NewByTypeURL(url string) (protobuf_go_lite.Message, bool)
NewByTypeURL constructs the message named by url.