feat(binding): support custom struct tag (#2720)

* feat(binding): support custom struct tag

Add function `binding.MapFormWithTag` (#2719)

* doc: add 'bind form-data with custom struct tag'

Add 'Bind form-data request with custom struct and custom tag' section (#2719)

* test(binding): add test for MapFromWithTag
This commit is contained in:
voidman
2021-06-30 00:53:56 +08:00
committed by GitHub
parent e3ee01d185
commit 690aa2b1b9
3 changed files with 68 additions and 0 deletions

View File

@ -34,6 +34,10 @@ func mapForm(ptr interface{}, form map[string][]string) error {
return mapFormByTag(ptr, form, "form")
}
func MapFormWithTag(ptr interface{}, form map[string][]string, tag string) error {
return mapFormByTag(ptr, form, tag)
}
var emptyField = reflect.StructField{}
func mapFormByTag(ptr interface{}, form map[string][]string, tag string) error {