TestMappingPtrField() — gin Function Reference
Architecture documentation for the TestMappingPtrField() function in form_mapping_test.go from the gin codebase.
Entity Profile
Dependency Diagram
graph TD 933edc8a_31c2_00bf_881a_d284efe76f07["TestMappingPtrField()"] 36de44f8_6a8c_78ab_4c20_59952e276c82["form_mapping_test.go"] 933edc8a_31c2_00bf_881a_d284efe76f07 -->|defined in| 36de44f8_6a8c_78ab_4c20_59952e276c82 style 933edc8a_31c2_00bf_881a_d284efe76f07 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
binding/form_mapping_test.go lines 444–475
func TestMappingPtrField(t *testing.T) {
type ptrStruct struct {
Key int64 `json:"key"`
}
type ptrRequest struct {
Items []*ptrStruct `json:"items" form:"items"`
}
var err error
// With 0 items.
var req0 ptrRequest
err = mappingByPtr(&req0, formSource{}, "form")
require.NoError(t, err)
assert.Empty(t, req0.Items)
// With 1 item.
var req1 ptrRequest
err = mappingByPtr(&req1, formSource{"items": {`{"key": 1}`}}, "form")
require.NoError(t, err)
assert.Len(t, req1.Items, 1)
assert.EqualValues(t, 1, req1.Items[0].Key)
// With 2 items.
var req2 ptrRequest
err = mappingByPtr(&req2, formSource{"items": {`{"key": 1}`, `{"key": 2}`}}, "form")
require.NoError(t, err)
assert.Len(t, req2.Items, 2)
assert.EqualValues(t, 1, req2.Items[0].Key)
assert.EqualValues(t, 2, req2.Items[1].Key)
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does TestMappingPtrField() do?
TestMappingPtrField() is a function in the gin codebase, defined in binding/form_mapping_test.go.
Where is TestMappingPtrField() defined?
TestMappingPtrField() is defined in binding/form_mapping_test.go at line 444.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free