trySplit() — gin Function Reference
Architecture documentation for the trySplit() function in form_mapping.go from the gin codebase.
Entity Profile
Dependency Diagram
graph TD 7c65b0b2_d5e8_8f89_a812_ae590c42c654["trySplit()"] 12913085_e498_18b3_5bda_a23669e608df["setByForm()"] 12913085_e498_18b3_5bda_a23669e608df -->|calls| 7c65b0b2_d5e8_8f89_a812_ae590c42c654 style 7c65b0b2_d5e8_8f89_a812_ae590c42c654 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
binding/form_mapping.go lines 213–243
func trySplit(vs []string, field reflect.StructField) (newVs []string, err error) {
cfTag := field.Tag.Get("collection_format")
if cfTag == "" || cfTag == "multi" {
return vs, nil
}
var sep string
switch cfTag {
case "csv":
sep = ","
case "ssv":
sep = " "
case "tsv":
sep = "\t"
case "pipes":
sep = "|"
default:
return vs, fmt.Errorf("%s is not supported in the collection_format. (multi, csv, ssv, tsv, pipes)", cfTag)
}
totalLength := 0
for _, v := range vs {
totalLength += strings.Count(v, sep) + 1
}
newVs = make([]string, 0, totalLength)
for _, v := range vs {
newVs = append(newVs, strings.Split(v, sep)...)
}
return newVs, nil
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does trySplit() do?
trySplit() is a function in the gin codebase.
What calls trySplit()?
trySplit() is called by 1 function(s): setByForm.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free