MCPcopy
hub / github.com/gorilla/mux / Queries

Method Queries

route.go:403–417  ·  view source on GitHub ↗

Query ---------------------------------------------------------------------- Queries adds a matcher for URL query values. It accepts a sequence of key/value pairs. Values may define variables. For example: r := mux.NewRouter().NewRoute() r.Queries("foo", "bar", "id", "{id:[0-9]+}") The above rou

(pairs ...string)

Source from the content-addressed store, hash-verified

401//
402// - {name:pattern} matches the given regexp pattern.
403func (r *Route) Queries(pairs ...string) *Route {
404 length := len(pairs)
405 if length%2 != 0 {
406 r.err = fmt.Errorf(
407 "mux: number of parameters must be multiple of 2, got %v", pairs)
408 return nil
409 }
410 for i := 0; i < length; i += 2 {
411 if r.err = r.addRegexpMatcher(pairs[i]+"="+pairs[i+1], regexpTypeQuery); r.err != nil {
412 return r
413 }
414 }
415
416 return r
417}
418
419// Schemes --------------------------------------------------------------------
420

Callers

nothing calls this directly

Calls 1

addRegexpMatcherMethod · 0.95

Tested by

no test coverage detected