addParameterMetaInfo() — fiber Function Reference
Architecture documentation for the addParameterMetaInfo() function in path.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD ded7de77_0f1b_05f0_b845_b9d6bfb5d3e6["addParameterMetaInfo()"] bedec411_93e0_4024_219e_79649f60a9be["path.go"] ded7de77_0f1b_05f0_b845_b9d6bfb5d3e6 -->|defined in| bedec411_93e0_4024_219e_79649f60a9be 6637b26a_4b2f_e8c6_2189_aa318e76e9bc["RemoveEscapeChar()"] ded7de77_0f1b_05f0_b845_b9d6bfb5d3e6 -->|calls| 6637b26a_4b2f_e8c6_2189_aa318e76e9bc style ded7de77_0f1b_05f0_b845_b9d6bfb5d3e6 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
path.go lines 258–300
func addParameterMetaInfo(segs []*routeSegment) []*routeSegment {
var comparePart string
segLen := len(segs)
// loop from end to begin
for i := segLen - 1; i >= 0; i-- {
// set the compare part for the parameter
if segs[i].IsParam {
// important for finding the end of the parameter
segs[i].ComparePart = RemoveEscapeChar(comparePart)
} else {
comparePart = segs[i].Const
if len(comparePart) > 1 {
comparePart = utils.TrimRight(comparePart, slashDelimiter)
}
}
}
// loop from beginning to end
for i := range segLen {
// check how often the compare part is in the following const parts
if segs[i].IsParam {
// check if parameter segments are directly after each other;
// when neither this parameter nor the next parameter are greedy, we only want one character
if segLen > i+1 && !segs[i].IsGreedy && segs[i+1].IsParam && !segs[i+1].IsGreedy {
segs[i].Length = 1
}
if segs[i].ComparePart == "" {
continue
}
for j := i + 1; j <= len(segs)-1; j++ {
if !segs[j].IsParam {
// count is important for the greedy match
segs[i].PartCount += strings.Count(segs[j].Const, segs[i].ComparePart)
}
}
// check if the end of the segment is an optional slash and then if the segment is optional or the last one
} else if segs[i].Const[len(segs[i].Const)-1] == slashDelimiter && (segs[i].IsLast || (segLen > i+1 && segs[i+1].IsOptional)) {
segs[i].HasOptionalSlash = true
}
}
return segs
}
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does addParameterMetaInfo() do?
addParameterMetaInfo() is a function in the fiber codebase, defined in path.go.
Where is addParameterMetaInfo() defined?
addParameterMetaInfo() is defined in path.go at line 258.
What does addParameterMetaInfo() call?
addParameterMetaInfo() calls 1 function(s): RemoveEscapeChar.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free