findParamLen() — fiber Function Reference
Architecture documentation for the findParamLen() function in path.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD 2fd95810_2ada_ab11_b5e5_4579a806f839["findParamLen()"] bedec411_93e0_4024_219e_79649f60a9be["path.go"] 2fd95810_2ada_ab11_b5e5_4579a806f839 -->|defined in| bedec411_93e0_4024_219e_79649f60a9be e448da38_7f9c_e7f4_07b9_47fdbbc2b234["findParamLenForLastSegment()"] 2fd95810_2ada_ab11_b5e5_4579a806f839 -->|calls| e448da38_7f9c_e7f4_07b9_47fdbbc2b234 005070ba_d3d6_212f_36df_f3fc9f497c80["findGreedyParamLen()"] 2fd95810_2ada_ab11_b5e5_4579a806f839 -->|calls| 005070ba_d3d6_212f_36df_f3fc9f497c80 style 2fd95810_2ada_ab11_b5e5_4579a806f839 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
path.go lines 561–591
func findParamLen(s string, segment *routeSegment) int {
if segment.IsLast {
return findParamLenForLastSegment(s, segment)
}
if segment.Length != 0 && len(s) >= segment.Length {
return segment.Length
} else if segment.IsGreedy {
// Search the parameters until the next constant part
// special logic for greedy params
searchCount := strings.Count(s, segment.ComparePart)
if searchCount > 1 {
return findGreedyParamLen(s, searchCount, segment)
}
}
if len(segment.ComparePart) == 1 {
if constPosition := strings.IndexByte(s, segment.ComparePart[0]); constPosition != -1 {
return constPosition
}
} else if constPosition := strings.Index(s, segment.ComparePart); constPosition != -1 {
// if the compare part was found, but contains a slash although this part is not greedy, then it must not match
// example: /api/:param/fixedEnd -> path: /api/123/456/fixedEnd = no match , /api/123/fixedEnd = match
if !segment.IsGreedy && strings.IndexByte(s[:constPosition], slashDelimiter) != -1 {
return 0
}
return constPosition
}
return len(s)
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does findParamLen() do?
findParamLen() is a function in the fiber codebase, defined in path.go.
Where is findParamLen() defined?
findParamLen() is defined in path.go at line 561.
What does findParamLen() call?
findParamLen() calls 2 function(s): findGreedyParamLen, findParamLenForLastSegment.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free