Test_CBORBinder_Bind() — fiber Function Reference
Architecture documentation for the Test_CBORBinder_Bind() function in cbor_test.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD f3364fd9_b459_c562_f09e_0e5cdb7d78a4["Test_CBORBinder_Bind()"] c3eb4349_8638_9743_621e_0c894e704e9b["cbor_test.go"] f3364fd9_b459_c562_f09e_0e5cdb7d78a4 -->|defined in| c3eb4349_8638_9743_621e_0c894e704e9b style f3364fd9_b459_c562_f09e_0e5cdb7d78a4 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
binder/cbor_test.go lines 10–61
func Test_CBORBinder_Bind(t *testing.T) {
t.Parallel()
b := &CBORBinding{
CBORDecoder: cbor.Unmarshal,
}
require.Equal(t, "cbor", b.Name())
type Post struct {
Title string `cbor:"title"`
}
type User struct {
Name string `cbor:"name"`
Posts []Post `cbor:"posts"`
Names []string `cbor:"names"`
Age int `cbor:"age"`
}
var user User
wantedUser := User{
Name: "john",
Names: []string{
"john",
"doe",
},
Age: 42,
Posts: []Post{
{Title: "post1"},
{Title: "post2"},
{Title: "post3"},
},
}
body, err := cbor.Marshal(wantedUser)
require.NoError(t, err)
err = b.Bind(body, &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)
require.Contains(t, user.Names, "john")
require.Contains(t, user.Names, "doe")
b.Reset()
require.Nil(t, b.CBORDecoder)
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does Test_CBORBinder_Bind() do?
Test_CBORBinder_Bind() is a function in the fiber codebase, defined in binder/cbor_test.go.
Where is Test_CBORBinder_Bind() defined?
Test_CBORBinder_Bind() is defined in binder/cbor_test.go at line 10.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free