baishaojie dcf2cbd820 first commit | 11 mesiacov pred | |
---|---|---|
.. | ||
msgpcode | 11 mesiacov pred | |
.prettierrc | 11 mesiacov pred | |
.travis.yml | 11 mesiacov pred | |
CHANGELOG.md | 11 mesiacov pred | |
LICENSE | 11 mesiacov pred | |
Makefile | 11 mesiacov pred | |
README.md | 11 mesiacov pred | |
commitlint.config.js | 11 mesiacov pred | |
decode.go | 11 mesiacov pred | |
decode_map.go | 11 mesiacov pred | |
decode_number.go | 11 mesiacov pred | |
decode_query.go | 11 mesiacov pred | |
decode_slice.go | 11 mesiacov pred | |
decode_string.go | 11 mesiacov pred | |
decode_value.go | 11 mesiacov pred | |
encode.go | 11 mesiacov pred | |
encode_map.go | 11 mesiacov pred | |
encode_number.go | 11 mesiacov pred | |
encode_slice.go | 11 mesiacov pred | |
encode_value.go | 11 mesiacov pred | |
ext.go | 11 mesiacov pred | |
go.mod | 11 mesiacov pred | |
go.sum | 11 mesiacov pred | |
intern.go | 11 mesiacov pred | |
msgpack.go | 11 mesiacov pred | |
package.json | 11 mesiacov pred | |
safe.go | 11 mesiacov pred | |
time.go | 11 mesiacov pred | |
types.go | 11 mesiacov pred | |
unsafe.go | 11 mesiacov pred | |
version.go | 11 mesiacov pred |
:heart: Uptrace.dev - All-in-one tool to optimize performance and monitor errors & logs
Other projects you may like:
msgpack:"my_field_name"
and alias via msgpack:"alias:another_name"
.msgpack:",omitempty"
tag or all
empty fields in a struct.msgpack supports 2 last Go versions and requires support for Go modules. So make sure to initialize a Go module:
go mod init github.com/my/repo
And then install msgpack/v5 (note v5 in the import; omitting it is a popular mistake):
go get github.com/vmihailenco/msgpack/v5
import "github.com/vmihailenco/msgpack/v5"
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
}