MCPcopy
hub / github.com/gin-gonic/gin / setFormMap

Function setFormMap

binding/form_mapping.go:528–550  ·  view source on GitHub ↗
(ptr any, form map[string][]string)

Source from the content-addressed store, hash-verified

526}
527
528func setFormMap(ptr any, form map[string][]string) error {
529 el := reflect.TypeOf(ptr).Elem()
530
531 if el.Kind() == reflect.Slice {
532 ptrMap, ok := ptr.(map[string][]string)
533 if !ok {
534 return ErrConvertMapStringSlice
535 }
536 maps.Copy(ptrMap, form)
537
538 return nil
539 }
540
541 ptrMap, ok := ptr.(map[string]string)
542 if !ok {
543 return ErrConvertToMapString
544 }
545 for k, v := range form {
546 ptrMap[k] = v[len(v)-1] // pick last
547 }
548
549 return nil
550}

Callers 1

mapFormByTagFunction · 0.85

Calls 1

CopyMethod · 0.80

Tested by

no test coverage detected