Documentation
¶
Index ¶
- Constants
- func ApplyJSON(js string, pb proto.Message) error
- func ApplyJSONStrict(js string, pb proto.Message) error
- func ApplyYAML(yml string, pb proto.Message) error
- func Clone[T proto.Message](obj T) T
- func Marshal(msg proto.Message) ([]byte, error)
- func MarshalIndent(msg proto.Message, indent string) ([]byte, error)
- func MessageToStructSlow(msg proto.Message) (*structpb.Struct, error)
- func ToJSON(msg proto.Message) (string, error)
- func ToJSONWithAnyResolver(msg proto.Message, indent string, anyResolver jsonpb.AnyResolver) (string, error)
- func ToJSONWithIndent(msg proto.Message, indent string) (string, error)
- func ToJSONWithOptions(msg proto.Message, indent string, enumsAsInts bool) (string, error)
- func ToYAML(msg proto.Message) (string, error)
- func Unmarshal(b []byte, m proto.Message) error
- func UnmarshalAllowUnknown(b []byte, m proto.Message) error
- type Codec
- type ComparableMessage
Constants ¶
const Name = "proto"
Variables ¶
This section is empty.
Functions ¶
func ApplyJSONStrict ¶
ApplyJSONStrict unmarshals a JSON string into a proto message.
func ApplyYAML ¶
ApplyYAML unmarshals a YAML string into a proto message. Unknown fields are allowed.
func Clone ¶
Clone is a small wrapper that handles the upstream function not returning a typed message
func MarshalIndent ¶
MarshalIndent marshals a proto to canonical JSON with indentation
func MessageToStructSlow ¶
MessageToStructSlow encodes a protobuf Message into a Struct. It roundtrips trough JSON so it is slow. Copied from https://github.com/envoyproxy/go-control-plane/blob/d77bd2ea68bdbb72afd65a7ddf6fe8969e556c45/pkg/conversion/struct.go#L29
func ToJSONWithAnyResolver ¶
func ToJSONWithIndent ¶
ToJSONWithIndent marshals a proto to canonical JSON with pretty printed string
func ToJSONWithOptions ¶
ToJSONWithOptions marshals a proto to canonical JSON with options to indent and print enums' int values
Types ¶
type ComparableMessage ¶
type ComparableMessage interface {
comparable
proto.Message
}