msgpack_test.go — fiber Source File
Architecture documentation for msgpack_test.go, a go file in the fiber codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 7fad0068_48d2_1c8d_0423_cf4802872c93["msgpack_test.go"] d412afc8_b482_999e_79ca_16b6ad9c2e7c["testing"] 7fad0068_48d2_1c8d_0423_cf4802872c93 --> d412afc8_b482_999e_79ca_16b6ad9c2e7c style 7fad0068_48d2_1c8d_0423_cf4802872c93 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
package binder
import (
"testing"
"github.com/shamaton/msgpack/v3"
"github.com/stretchr/testify/require"
)
func Test_Msgpack_Binding_Bind(t *testing.T) {
t.Parallel()
b := &MsgPackBinding{
MsgPackDecoder: msgpack.Unmarshal,
}
require.Equal(t, "msgpack", b.Name())
type Post struct {
Title string `msgpack:"title"`
}
type User struct {
Name string `msgpack:"name"`
Posts []Post `msgpack:"posts"`
Age int `msgpack:"age"`
}
var user User
// Prepare msgpack data
input := map[string]any{
"name": "john",
"age": 42,
"posts": []map[string]any{
{"title": "post1"},
{"title": "post2"},
{"title": "post3"},
},
}
data, err := msgpack.Marshal(input)
require.NoError(t, err)
err = b.Bind(data, &user)
require.NoError(t, err)
require.Equal(t, "john", user.Name)
require.Equal(t, 42, user.Age)
require.Len(t, user.Posts, 3)
require.Equal(t, "post1", user.Posts[0].Title)
require.Equal(t, "post2", user.Posts[1].Title)
require.Equal(t, "post3", user.Posts[2].Title)
b.Reset()
require.Nil(t, b.MsgPackDecoder)
}
func Benchmark_Msgpack_Binding_Bind(b *testing.B) {
b.ReportAllocs()
binder := &MsgPackBinding{
MsgPackDecoder: msgpack.Unmarshal,
}
// ... (74 more lines)
Domain
Subdomains
Functions
Dependencies
- testing
Source
Frequently Asked Questions
What does msgpack_test.go do?
msgpack_test.go is a source file in the fiber codebase, written in go. It belongs to the DataBinding domain, PayloadParsers subdomain.
What functions are defined in msgpack_test.go?
msgpack_test.go defines 6 function(s): Benchmark_Msgpack_Binding_Bind, Test_Msgpack_Binding_Bind, Test_UnimplementedMsgpackMarshal_PanicMessage, Test_UnimplementedMsgpackMarshal_Panics, Test_UnimplementedMsgpackUnmarshal_PanicMessage, Test_UnimplementedMsgpackUnmarshal_Panics.
What does msgpack_test.go depend on?
msgpack_test.go imports 1 module(s): testing.
Where is msgpack_test.go in the architecture?
msgpack_test.go is located at binder/msgpack_test.go (domain: DataBinding, subdomain: PayloadParsers, directory: binder).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free