msgpack

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 14, 2019 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const (
	NilFormat byte = 0xc0 + iota
	NeverUsedFormat
	FalseFormat
	TrueFormat
	Bin8Format
	Bin16Format
	Bin32Format
	Ext8Format
	Ext16Format
	Ext32Format
	Float32Format
	Float64Format
	Uint8Format
	Uint16Format
	Uint32Format
	Uint64Format
	Int8Format
	Int16Format
	Int32Format
	Int64Format
	FixExt1Format
	FixExt2Format
	FixExt4Format
	FixExt8Format
	FixExt16Format
	Str8Format
	Str16Format
	Str32Format
	Array16Format
	Array32Format
	Map16Format
	Map32Format
)

First Byte of each format.

https://github.com/msgpack/msgpack/blob/master/spec.md#overview

Variables

This section is empty.

Functions

func IsArray

func IsArray(b byte) bool

IsArray reports whether the byte is array format family header.

func IsBin

func IsBin(b byte) bool

IsBin reports whether the byte is bin format family header.

func IsExt

func IsExt(b byte) bool

IsExt reports whether the byte is ext format family header.

func IsMap

func IsMap(b byte) bool

IsMap reports whether the byte is map format family header.

func IsString

func IsString(b byte) bool

IsString reports whether the byte is str format family header.

func RegisterExt

func RegisterExt(ext *ExtFormat) error

RegisterExt register user defined ext format.

func RegisterFluentdEventTime

func RegisterFluentdEventTime()

RegisterFluentdEventTime registers Fluentd ext timestamp format. https://github.com/fluent/fluentd/wiki/Forward-Protocol-Specification-v1 */

Types

type ExtFormat

type ExtFormat struct {
	FirstByte  byte
	ExtType    int8
	TypeName   string
	DecodeFunc func([]byte) string
}

ExtFormat represents Ext Format.

func (*ExtFormat) String

func (obj *ExtFormat) String() string

String implements Stringer interface.

type MPObject

type MPObject struct {
	FirstByte byte
	TypeName  string
	ExtType   int8   /* for ext family*/
	Length    uint32 /* for map, array and str family*/
	DataStr   string
	Raw       []byte
	Child     []*MPObject
}

MPObject represents message pack object. If the object is array or map, MPObject has Child which represents each element.

func Decode

func Decode(buf *bytes.Buffer) (*MPObject, error)

Decode analyzes buf and convert MPObject.

func (*MPObject) String

func (obj *MPObject) String() string

String implements Stringer interface.

Jump to

Keyboard shortcuts

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