jason 075d766964 first %!s(int64=3) %!d(string=hai) anos
..
codes 075d766964 first %!s(int64=3) %!d(string=hai) anos
.travis.yml 075d766964 first %!s(int64=3) %!d(string=hai) anos
CHANGELOG.md 075d766964 first %!s(int64=3) %!d(string=hai) anos
LICENSE 075d766964 first %!s(int64=3) %!d(string=hai) anos
Makefile 075d766964 first %!s(int64=3) %!d(string=hai) anos
README.md 075d766964 first %!s(int64=3) %!d(string=hai) anos
appengine.go 075d766964 first %!s(int64=3) %!d(string=hai) anos
bench_test.go 075d766964 first %!s(int64=3) %!d(string=hai) anos
decode.go 075d766964 first %!s(int64=3) %!d(string=hai) anos
decode_map.go 075d766964 first %!s(int64=3) %!d(string=hai) anos
decode_number.go 075d766964 first %!s(int64=3) %!d(string=hai) anos
decode_query.go 075d766964 first %!s(int64=3) %!d(string=hai) anos
decode_slice.go 075d766964 first %!s(int64=3) %!d(string=hai) anos
decode_string.go 075d766964 first %!s(int64=3) %!d(string=hai) anos
decode_value.go 075d766964 first %!s(int64=3) %!d(string=hai) anos
encode.go 075d766964 first %!s(int64=3) %!d(string=hai) anos
encode_map.go 075d766964 first %!s(int64=3) %!d(string=hai) anos
encode_number.go 075d766964 first %!s(int64=3) %!d(string=hai) anos
encode_slice.go 075d766964 first %!s(int64=3) %!d(string=hai) anos
encode_value.go 075d766964 first %!s(int64=3) %!d(string=hai) anos
example_CustomEncoder_test.go 075d766964 first %!s(int64=3) %!d(string=hai) anos
example_registerExt_test.go 075d766964 first %!s(int64=3) %!d(string=hai) anos
example_test.go 075d766964 first %!s(int64=3) %!d(string=hai) anos
ext.go 075d766964 first %!s(int64=3) %!d(string=hai) anos
ext_test.go 075d766964 first %!s(int64=3) %!d(string=hai) anos
msgpack.go 075d766964 first %!s(int64=3) %!d(string=hai) anos
msgpack_test.go 075d766964 first %!s(int64=3) %!d(string=hai) anos
tag.go 075d766964 first %!s(int64=3) %!d(string=hai) anos
time.go 075d766964 first %!s(int64=3) %!d(string=hai) anos
types.go 075d766964 first %!s(int64=3) %!d(string=hai) anos
types_test.go 075d766964 first %!s(int64=3) %!d(string=hai) anos

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