Documentation
¶
Index ¶
- Variables
- type Params
- type Route
- type RouteMap
- type Router
- func (r Router) Add(path string, route ...string) error
- func (r Router) AddAll(m RouteMap) error
- func (r Router) GetRoute(urlToMatch *url.URL) (Params, Route, error)
- func (r Router) GetURL(originalParams Params, route ...string) (string, error)
- func (r Router) MustGetRoute(urlToMatch *url.URL) (Params, Route)
- func (r Router) MustGetURL(originalParams Params, route ...string) string
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidChars = errors.New("Invalid characters")
ErrInvalidChars is returned when invalid characters are used in the route
View Source
var ErrMiddleSuffix = errors.New("Suffix parameters can only happen at the end of the path")
ErrMiddleSuffix is returned when the provided path contains a suffix not located at the end
View Source
var ErrMissingParam = errors.New("Missing parameter")
ErrMissingParam is returned when there is a missing parameter
View Source
var ErrNotFound = errors.New("Requested route not found")
ErrNotFound is returned when the requested route could not be found
Functions ¶
This section is empty.
Types ¶
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router holds the list of routings and mappings
func BuildRouter ¶
BuildRouter builds a new router instance and adds the provided routes to it, panicking if there's an error adding the routes
func (Router) MustGetRoute ¶
MustGetRoute gets the URL from the given route and parameters and panics if there's an error
Click to show internal directories.
Click to hide internal directories.