Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Converter ¶
type Converter struct { Parser ProtoParser Filename string Package, MessageType string Indent bool EndOfMessageMarker string }
Converter converts proto message to json using definition provided by ProtoParser.
func (Converter) ConvertStream ¶
ConvertStream converts multiple proto messages to json. It returns a result channel and error channel which both can return multiple messages (a result or error for each message) Because proto messages often contain newlines, we can't rely on new lines for knowing when one message ends and the next begins, so instead it looks for a line containing only a specified marker (defaults to DefaultEndOfMessageMarker). Although unlikely, it is possible that the EndOfMessageMarker can be part of the proto binary message, in which case the parsing of that message will fail. If this happens, use a more complex EndOfMessageMarker.
type ProtoParser ¶
type ProtoParser interface {
ParseFiles(filenames ...string) ([]*desc.FileDescriptor, error)
}
ProtoParser defines the interface for parsing proto files dynamically.