Documentation ¶
Overview ¶
Package protobuf provides helpers for working with golang/protobuf types.
Package protobuf provides helpers for working with golang/protobuf types.
Index ¶
- func AsMessages[T proto.Message](messages []T) []proto.Message
- func ExpectEqual(t *testing.T, want, got any) bool
- func MustMarshalAny(pb proto.Message) *anypb.Any
- func RequireEqual(t *testing.T, want, got any)
- func UInt32OrDefault(val, def uint32) *wrapperspb.UInt32Value
- func UInt32OrNil(val uint32) *wrapperspb.UInt32Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsMessages ¶ added in v1.4.0
AsMessages converts the given slice of values (that implement the proto.Message interface) to a slice of proto.Message. If the length of the slice is 0, it returns nil.
func ExpectEqual ¶ added in v1.8.0
ExpectEqual will test that want == got for protobufs, call t.Error if it does not, and return a bool to indicate the result. This mimics the behavior of the testify `assert` functions.
func MustMarshalAny ¶ added in v1.5.0
MustMarshalAny marshals a protobuf into an any.Any type, panicking if that operation fails.
func RequireEqual ¶ added in v1.8.0
RequireEqual will test that want == got for protobufs, call t.fatal if it does not, This mimics the behavior of the testify `require` functions.
func UInt32OrDefault ¶ added in v1.9.0
func UInt32OrDefault(val, def uint32) *wrapperspb.UInt32Value
UInt32OrDefault returns a wrapped UInt32Value. If val is 0, def is wrapped and returned.
func UInt32OrNil ¶ added in v1.9.0
func UInt32OrNil(val uint32) *wrapperspb.UInt32Value
UInt32OrNil returns a wrapped UInt32Value. If val is 0, nil is returned
Types ¶
This section is empty.