Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompactText ¶
CompactText writes the compact proto text format of m to w.
func CompactTextString ¶
CompactTextString returns a compact proto text formatted string of m.
func MarshalText ¶
MarshalText writes the proto text format of m to w.
func MarshalTextString ¶
MarshalTextString returns a proto text formatted string of m.
func MessageReflect ¶
func MessageReflect(m Message) protoreflect.Message
MessageReflect returns a reflective view for a message. It returns nil if m is nil.
Types ¶
type Message ¶
type Message = protoiface.MessageV1
Message is a protocol buffer message.
This is the v1 version of the message interface and is marginally better than an empty interface as it lacks any method to programatically interact with the contents of the message.
A v2 message is declared in "google.golang.org/protobuf/proto".Message and exposes protobuf reflection as a first-class feature of the interface.
To convert a v1 message to a v2 message, use the MessageV2 function. To convert a v2 message to a v1 message, use the MessageV1 function.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
func WithStringLimit ¶
type TextMarshaler ¶
type TextMarshaler struct { Compact bool // use compact text format (one line) ExpandAny bool // expand google.protobuf.Any messages of known types // contains filtered or unexported fields }
TextMarshaler is a configurable text format marshaler.
func NewMarshaler ¶
func NewMarshaler(opts ...Option) TextMarshaler
func (*TextMarshaler) Marshal ¶
func (tm *TextMarshaler) Marshal(w io.Writer, m Message) error
Marshal writes the proto text format of m to w.
func (*TextMarshaler) Text ¶
func (tm *TextMarshaler) Text(m Message) string
Text returns a proto text formatted string of m.