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.
()
| 684 | // against third-party services. |
| 685 | // An error will be returned if the route does not define queries. |
| 686 | func (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 |
no outgoing calls