MCPcopy
hub / github.com/julienschmidt/httprouter / ByName

Method ByName

router.go:103–110  ·  view source on GitHub ↗

ByName returns the value of the first Param which key matches the given name. If no matching Param is found, an empty string is returned.

(name string)

Source from the content-addressed store, hash-verified

101// ByName returns the value of the first Param which key matches the given name.
102// If no matching Param is found, an empty string is returned.
103func (ps Params) ByName(name string) string {
104 for i := range ps {
105 if ps[i].Key == name {
106 return ps[i].Value
107 }
108 }
109 return ""
110}
111
112type paramsKey struct{}
113

Callers 2

TestParamsFunction · 0.95
ServeFilesMethod · 0.80

Calls

no outgoing calls

Tested by 1

TestParamsFunction · 0.76