Params return the names of the parameters used in URI if any.
()
| 255 | |
| 256 | // Params return the names of the parameters used in URI if any. |
| 257 | func (u URIExpr) Params() []string { |
| 258 | r := regexp.MustCompile(`\{([^\{\}]+)\}`) |
| 259 | matches := r.FindAllStringSubmatch(string(u), -1) |
| 260 | if len(matches) == 0 { |
| 261 | return nil |
| 262 | } |
| 263 | wcs := make([]string, len(matches)) |
| 264 | for i, m := range matches { |
| 265 | wcs[i] = m[1] |
| 266 | } |
| 267 | return wcs |
| 268 | } |
| 269 | |
| 270 | // Scheme returns the URI scheme. Possible values are http, https, grpc, and |
| 271 | // grpcs. |