transutil

package
v0.0.0-...-32f242e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2020 License: ISC Imports: 11 Imported by: 0

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

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 Gzipper

func Gzipper(r io.Reader) *transform.Transformer

Gzipper will gzip 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

func JSONToProtoBuf(r io.Reader, pb proto.Message, multimessage bool) *transform.Transformer

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

func ProtoBufToJSON(r io.Reader, pb proto.Message, multimessage bool) *transform.Transformer

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.

Directories

Path Synopsis
Package test_proto is a generated protocol buffer package.
Package test_proto is a generated protocol buffer package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL