Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

429 Commits

Repository files navigation

MessagePack encoding for Golang

Build StatusGoDoc

Sponsors

Features

API docs: https://pkg.go.dev/github.com/vmihailenco/msgpack/v5?tab=doc. Examples: https://pkg.go.dev/github.com/vmihailenco/msgpack/v5?tab=doc#pkg-examples.

Installation

This project uses Go Modules and semantic import versioning since v4:

go mod init github.com/my/repo
go get github.com/vmihailenco/msgpack/v5

Quickstart

import"github.com/vmihailenco/msgpack/v5"funcExampleMarshal() {
typeItemstruct {
Foostring
}
b, err:=msgpack.Marshal(&Item{Foo: "bar"})
iferr!=nil {
panic(err)
}
varitemItemerr=msgpack.Unmarshal(b, &item)
iferr!=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

About

msgpack.org[Go] MessagePack encoding for Golang

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages