|  | il y a 1 an | |
|---|---|---|
| .. | ||
| msgpcode | il y a 1 an | |
| .prettierrc | il y a 1 an | |
| .travis.yml | il y a 1 an | |
| CHANGELOG.md | il y a 1 an | |
| LICENSE | il y a 1 an | |
| Makefile | il y a 1 an | |
| README.md | il y a 1 an | |
| commitlint.config.js | il y a 1 an | |
| decode.go | il y a 1 an | |
| decode_map.go | il y a 1 an | |
| decode_number.go | il y a 1 an | |
| decode_query.go | il y a 1 an | |
| decode_slice.go | il y a 1 an | |
| decode_string.go | il y a 1 an | |
| decode_value.go | il y a 1 an | |
| encode.go | il y a 1 an | |
| encode_map.go | il y a 1 an | |
| encode_number.go | il y a 1 an | |
| encode_slice.go | il y a 1 an | |
| encode_value.go | il y a 1 an | |
| ext.go | il y a 1 an | |
| go.mod | il y a 1 an | |
| go.sum | il y a 1 an | |
| intern.go | il y a 1 an | |
| msgpack.go | il y a 1 an | |
| package.json | il y a 1 an | |
| safe.go | il y a 1 an | |
| time.go | il y a 1 an | |
| types.go | il y a 1 an | |
| unsafe.go | il y a 1 an | |
| version.go | il y a 1 an | |
: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
}