Go Makefile
Latest commit b5e691b Jun 13, 2018
Permalink
Failed to load latest commit information.
codes Decode time formatted according to RFC3339 into time.Time May 17, 2018
.travis.yml Decode time formatted according to RFC3339 into time.Time May 17, 2018
CHANGELOG.md Don't autoinline struct fields if there are name conflicts Mar 19, 2018
LICENSE Cleanup license Jun 17, 2017
Makefile Encode error interface as string. Decode string into error interface. F… Nov 14, 2016
README.md readme: mention UseJSONTag Feb 6, 2018
appengine.go Implement time extension May 11, 2017
bench_test.go Remove allocations from byteWriter Jan 31, 2018
decode.go Improve doc for DecodeInterface Mar 14, 2018
decode_map.go Fallback to json struct tag if no msgpack tag is present Feb 6, 2018
decode_number.go Improve doc for DecodeInterface Mar 14, 2018
decode_query.go Add SetLoose method to Decoder to enable automatic loose decoding beh… Feb 5, 2018
decode_slice.go Add SetLoose method to Decoder to enable automatic loose decoding beh… Feb 5, 2018
decode_string.go Don't panic if value can't be set Nov 30, 2017
decode_value.go Fix ext decoding in custom decoder Apr 16, 2018
encode.go Fallback to json struct tag if no msgpack tag is present Feb 6, 2018
encode_map.go Fallback to json struct tag if no msgpack tag is present Feb 6, 2018
encode_number.go Create Code type and use it Jun 22, 2017
encode_slice.go Use Encoder.buf to encode byte array Jan 30, 2018
encode_value.go Accept extension with unmarshaller and custom decoder May 2, 2017
example_CustomEncoder_test.go Remove gopkg.in May 11, 2017
example_registerExt_test.go Return ptr to the value when decoding into interface Oct 29, 2017
example_test.go Improve example Jan 31, 2018
ext.go Code cleanup Jun 13, 2018
ext_test.go Export DecodeExtHeader in Decoder Jun 12, 2018
msgpack.go Remove EncodeSliceLen May 11, 2017
msgpack_test.go Don't panic if value can't be set Nov 30, 2017
tag.go Improve tag parsing Jul 23, 2017
time.go Decode time formatted according to RFC3339 into time.Time May 17, 2018
types.go Don't autoinline struct fields if there are name conflicts Mar 19, 2018
types_test.go Decode time formatted according to RFC3339 into time.Time May 17, 2018

README.md

MessagePack encoding for Golang

Build Status GoDoc

Supports:

API docs: https://godoc.org/github.com/vmihailenco/msgpack. Examples: https://godoc.org/github.com/vmihailenco/msgpack#pkg-examples.

Installation

Install:

go get -u github.com/vmihailenco/msgpack

Quickstart

func ExampleMarshal() {
	type Item struct {
		Foo string
	}

	b, err := msgpack.Marshal(&Item{Foo: "bar"})
	if err != nil {
		panic(err)
	}

	var item Item
	err = msgpack.Unmarshal(b, &item)
	if err != nil {
		panic(err)
	}
	fmt.Println(item.Foo)
	// Output: bar
}

Benchmark

BenchmarkStructVmihailencoMsgpack-4   	  200000	     12814 ns/op	    2128 B/op	      26 allocs/op
BenchmarkStructUgorjiGoMsgpack-4      	  100000	     17678 ns/op	    3616 B/op	      70 allocs/op
BenchmarkStructUgorjiGoCodec-4        	  100000	     19053 ns/op	    7346 B/op	      23 allocs/op
BenchmarkStructJSON-4                 	   20000	     69438 ns/op	    7864 B/op	      26 allocs/op
BenchmarkStructGOB-4                  	   10000	    104331 ns/op	   14664 B/op	     278 allocs/op

Howto

Please go through examples to get an idea how to use this package.

See also