Test_JSON_Binding_Bind() — fiber Function Reference
Architecture documentation for the Test_JSON_Binding_Bind() function in json_test.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD c639d186_1353_d2b1_ddda_0ac6e7b64bd5["Test_JSON_Binding_Bind()"] b5c7d338_90e1_2834_abc9_49dc09418b2f["json_test.go"] c639d186_1353_d2b1_ddda_0ac6e7b64bd5 -->|defined in| b5c7d338_90e1_2834_abc9_49dc09418b2f style c639d186_1353_d2b1_ddda_0ac6e7b64bd5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
binder/json_test.go lines 10–40
func Test_JSON_Binding_Bind(t *testing.T) {
t.Parallel()
b := &JSONBinding{
JSONDecoder: json.Unmarshal,
}
require.Equal(t, "json", b.Name())
type Post struct {
Title string `json:"title"`
}
type User struct {
Name string `json:"name"`
Posts []Post `json:"posts"`
Age int `json:"age"`
}
var user User
err := b.Bind([]byte(`{"name":"john","age":42,"posts":[{"title":"post1"},{"title":"post2"},{"title":"post3"}]}`), &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.JSONDecoder)
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does Test_JSON_Binding_Bind() do?
Test_JSON_Binding_Bind() is a function in the fiber codebase, defined in binder/json_test.go.
Where is Test_JSON_Binding_Bind() defined?
Test_JSON_Binding_Bind() is defined in binder/json_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