Home / File/ form_mapping.go — gin Source File

form_mapping.go — gin Source File

Architecture documentation for form_mapping.go, a go file in the gin codebase. 1 imports, 0 dependents.

File go RequestBinding FormBinding 1 imports 22 functions 10 classes

Entity Profile

Dependency Diagram

graph LR
  0bcba57f_f00e_ed0e_0516_ee30758711c8["form_mapping.go"]
  ba6df5a0_c664_7fb2_95fb_0bdbdc441db8["encoding"]
  0bcba57f_f00e_ed0e_0516_ee30758711c8 --> ba6df5a0_c664_7fb2_95fb_0bdbdc441db8
  style 0bcba57f_f00e_ed0e_0516_ee30758711c8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

// Copyright 2014 Manu Martinez-Almeida. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.

package binding

import (
	"encoding"
	"errors"
	"fmt"
	"maps"
	"mime/multipart"
	"reflect"
	"strconv"
	"strings"
	"time"

	"github.com/gin-gonic/gin/codec/json"
	"github.com/gin-gonic/gin/internal/bytesconv"
)

var (
	errUnknownType = errors.New("unknown type")

	// ErrConvertMapStringSlice can not convert to map[string][]string
	ErrConvertMapStringSlice = errors.New("can not convert to map slices of strings")

	// ErrConvertToMapString can not convert to map[string]string
	ErrConvertToMapString = errors.New("can not convert to map of strings")
)

func mapURI(ptr any, m map[string][]string) error {
	return mapFormByTag(ptr, m, "uri")
}

func mapForm(ptr any, form map[string][]string) error {
	return mapFormByTag(ptr, form, "form")
}

func MapFormWithTag(ptr any, form map[string][]string, tag string) error {
	return mapFormByTag(ptr, form, tag)
}

var emptyField = reflect.StructField{}

func mapFormByTag(ptr any, form map[string][]string, tag string) error {
	// Check if ptr is a map
	ptrVal := reflect.ValueOf(ptr)
	var pointed any
	if ptrVal.Kind() == reflect.Ptr {
		ptrVal = ptrVal.Elem()
		pointed = ptrVal.Interface()
	}
	if ptrVal.Kind() == reflect.Map &&
		ptrVal.Type().Key().Kind() == reflect.String {
		if pointed != nil {
			ptr = pointed
		}
		return setFormMap(ptr, form)
	}
// ... (491 more lines)

Subdomains

Dependencies

  • encoding

Frequently Asked Questions

What does form_mapping.go do?
form_mapping.go is a source file in the gin codebase, written in go. It belongs to the RequestBinding domain, FormBinding subdomain.
What functions are defined in form_mapping.go?
form_mapping.go defines 22 function(s): MapFormWithTag, head, mapForm, mapFormByTag, mapURI, mapping, mappingByPtr, setArray, setBoolField, setByForm, and 12 more.
What does form_mapping.go depend on?
form_mapping.go imports 1 module(s): encoding.
Where is form_mapping.go in the architecture?
form_mapping.go is located at binding/form_mapping.go (domain: RequestBinding, subdomain: FormBinding, directory: binding).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free