Documentation
¶
Overview ¶
Package transutil provides a set of example utilites for converting between common data formats using an io.Reader. Currently supporte are JSON, MsgPack, and ProtoBuf. Also provided is Gzipper/Gunzipper readers.
Index ¶
- func Gunzipper(r io.Reader) *transform.Transformer
- func Gzipper(r io.Reader) *transform.Transformer
- func JSONToMsgPack(r io.Reader) *transform.Transformer
- func JSONToPrettyJSON(r io.Reader) *transform.Transformer
- func JSONToProtoBuf(r io.Reader, pb proto.Message, multimessage bool) *transform.Transformer
- func JSONToUglyJSON(r io.Reader) *transform.Transformer
- func MsgPackToJSON(r io.Reader) *transform.Transformer
- func ProtoBufToJSON(r io.Reader, pb proto.Message, multimessage bool) *transform.Transformer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Gunzipper ¶
func Gunzipper(r io.Reader) *transform.Transformer
Gunzipper will gunzip the input reader
func JSONToMsgPack ¶
func JSONToMsgPack(r io.Reader) *transform.Transformer
JSONToMsgPack returns an io.Reader that converts JSON messages into MsgPack messages.
func JSONToPrettyJSON ¶
func JSONToPrettyJSON(r io.Reader) *transform.Transformer
JSONToPrettyJSON returns an io.Reader that converts JSON messages by making them more human readable using indentation and linebreaks.
func JSONToProtoBuf ¶
JSONToProtoBuf returns an io.Reader that converts JSON messages into Protocol Buffers.
The pb param is the proto buffer definition that conforms to the proto.Message interface. This param is only used during the conversion process and MUST NOT be used after calling this function.
The multimessage param is used for sending multiple messages over the same stream. When this param is set, additional varint bytes are added to the beginning of each message. Otherwise only one message is allowed.
func JSONToUglyJSON ¶
func JSONToUglyJSON(r io.Reader) *transform.Transformer
JSONToUglyJSON returns an io.Reader that converts JSON messages by removing all unneeded whitespace.
func MsgPackToJSON ¶
func MsgPackToJSON(r io.Reader) *transform.Transformer
MsgPackToJSON returns an io.Reader that converts MsgPack messages into JSON messages.
func ProtoBufToJSON ¶
ProtoBufToJSON returns an io.Reader that converts Proto Buffer messages into JSON.
The pb param is the proto buffer definition that conforms to the proto.Message interface. This param is only used during the conversion process and MUST NOT be used after calling this function.
The multimessage param is used for sending multiple messages over the same stream. When this param is set, additional varint bytes are added to the beginning of each message. Otherwise only one message is allowed.
Types ¶
This section is empty.