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

Method GetQueriesTemplates

route.go:686–698  ·  view source on GitHub ↗

GetQueriesTemplates returns the templates used to build the query matching. This is useful for building simple REST API documentation and for instrumentation against third-party services. An error will be returned if the route does not define queries.

()

Source from the content-addressed store, hash-verified

684// against third-party services.
685// An error will be returned if the route does not define queries.
686func (r *Route) GetQueriesTemplates() ([]string, error) {
687 if r.err != nil {
688 return nil, r.err
689 }
690 if r.regexp.queries == nil {
691 return nil, errors.New("mux: route doesn't have queries")
692 }
693 queries := make([]string, 0, len(r.regexp.queries))
694 for _, query := range r.regexp.queries {
695 queries = append(queries, query.template)
696 }
697 return queries, nil
698}
699
700// GetMethods returns the methods the route matches against
701// This is useful for building simple REST API documentation and for instrumentation

Callers 1

testQueriesTemplatesFunction · 0.80

Calls

no outgoing calls

Tested by 1

testQueriesTemplatesFunction · 0.64