mapping() — gin Function Reference
Architecture documentation for the mapping() function in form_mapping.go from the gin codebase.
Entity Profile
Dependency Diagram
graph TD 26bf428b_0733_115a_bf9f_f206c7ab67b2["mapping()"] 0bcba57f_f00e_ed0e_0516_ee30758711c8["form_mapping.go"] 26bf428b_0733_115a_bf9f_f206c7ab67b2 -->|defined in| 0bcba57f_f00e_ed0e_0516_ee30758711c8 539b92cd_a54f_79eb_70b0_e310bfb7f895["mappingByPtr()"] 539b92cd_a54f_79eb_70b0_e310bfb7f895 -->|calls| 26bf428b_0733_115a_bf9f_f206c7ab67b2 4254e947_60e5_3f50_dde1_ae8d47a783ba["tryToSetValue()"] 26bf428b_0733_115a_bf9f_f206c7ab67b2 -->|calls| 4254e947_60e5_3f50_dde1_ae8d47a783ba style 26bf428b_0733_115a_bf9f_f206c7ab67b2 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
binding/form_mapping.go lines 84–136
func mapping(value reflect.Value, field reflect.StructField, setter setter, tag string) (bool, error) {
if field.Tag.Get(tag) == "-" { // just ignoring this field
return false, nil
}
vKind := value.Kind()
if vKind == reflect.Ptr {
var isNew bool
vPtr := value
if value.IsNil() {
isNew = true
vPtr = reflect.New(value.Type().Elem())
}
isSet, err := mapping(vPtr.Elem(), field, setter, tag)
if err != nil {
return false, err
}
if isNew && isSet {
value.Set(vPtr)
}
return isSet, nil
}
if vKind != reflect.Struct || !field.Anonymous {
ok, err := tryToSetValue(value, field, setter, tag)
if err != nil {
return false, err
}
if ok {
return true, nil
}
}
if vKind == reflect.Struct {
tValue := value.Type()
var isSet bool
for i := range value.NumField() {
sf := tValue.Field(i)
if sf.PkgPath != "" && !sf.Anonymous { // unexported
continue
}
ok, err := mapping(value.Field(i), sf, setter, tag)
if err != nil {
return false, err
}
isSet = isSet || ok
}
return isSet, nil
}
return false, nil
}
Domain
Subdomains
Defined In
Calls
Called By
Source
Frequently Asked Questions
What does mapping() do?
mapping() is a function in the gin codebase, defined in binding/form_mapping.go.
Where is mapping() defined?
mapping() is defined in binding/form_mapping.go at line 84.
What does mapping() call?
mapping() calls 1 function(s): tryToSetValue.
What calls mapping()?
mapping() is called by 1 function(s): mappingByPtr.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free