MCPcopy
hub / github.com/go-chi/chi / patParamKeys

Function patParamKeys

tree.go:755–771  ·  view source on GitHub ↗
(pattern string)

Source from the content-addressed store, hash-verified

753}
754
755func patParamKeys(pattern string) []string {
756 pat := pattern
757 paramKeys := []string{}
758 for {
759 ptyp, paramKey, _, _, _, e := patNextSegment(pat)
760 if ptyp == ntStatic {
761 return paramKeys
762 }
763 for i := 0; i < len(paramKeys); i++ {
764 if paramKeys[i] == paramKey {
765 panic(fmt.Sprintf("chi: routing pattern '%s' contains duplicate param key, '%s'", pattern, paramKey))
766 }
767 }
768 paramKeys = append(paramKeys, paramKey)
769 pat = pat[e:]
770 }
771}
772
773// longestPrefix finds the length of the shared prefix of two strings
774func longestPrefix(k1, k2 string) (i int) {

Callers 1

setEndpointMethod · 0.85

Calls 1

patNextSegmentFunction · 0.85

Tested by

no test coverage detected