Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func As ¶
func As[M PointerMessage[T], T any](msg proto.Message) (M, error)
As returns the given message as type M. If the given message is type M, it is returned as-is. Otherwise (like if the given message is a dynamic message), it will be marshalled to bytes and then unmarshalled into a value of type M. If M and msg do not share the same message type (e.g. same fully qualified message name), an error is returned.
func Walk ¶
func Walk(root protoreflect.Message, action func(path []any, val protoreflect.Message) bool)
Walk traverses the given root messages, iterating through its fields and through all values in maps and lists, calling the given action for all message values encountered. The given action is called for root first before being called for any contained message values.
The path provided to the callback is the sequence of field numbers, map keys, and list indices that identifies the location of the given message. It is empty when called for the root message.
If the callback returns false, the traversal is terminated and the callback will not be invoked again.
Types ¶
type PointerMessage ¶
PointerMessage is a pointer type that implements proto.Message.