| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
urlpath provides a way to parse URL path elements using a schema
For users of gorilla/mux.
The urlpath package can be added to a project by running:
go get cattlecloud.net/go/urlpath@latestimport "cattlecloud.net/go/urlpath"Make use of gorilla's path variables.
router.Handle("/v1/{category}/{name}", newHandler())Create a Schema and call Parse to extract the path variables.
var (
category int
name string
)
urlpath.MustParse(request, urlpath.Schema {
"category": urlpath.Int(&category),
"name": urlpath.String(&name),
})A error version also exists.
err := urlpath.Parse(request, urlpath.Schema {
"category": urlpath.Int(&category),
"name": urlpath.String(&name),
})The cattlecloud.net/go/urlpath module is open source under the BSD license.
| Back | FazBrowse Home | New Git URL |