Documentation
¶
Index ¶
Constants ¶
const ( //RouteKey Context value key for provided path RouteKey = "sr.Route:Key" //RouteName Context value key for provided path RouteName = "sr.Route:Name" )
Variables ¶
var ErrRouteNotFound = errors.New("Route Not Found")
ErrRouteNotFound route was not found
Functions ¶
This section is empty.
Types ¶
type HandlerFunc ¶
HandlerFunc simplified Handler interface
type OptFn ¶
type OptFn func(*Router)
OptFn option function
func RootPrefix ¶
RootPrefix set rootPrefix for this router this is used to add a universal route that is not part of routing scheme mount the same routing on different roots without changing your scheme
func RouteCallback ¶
RouteCallback called when a route matches with info
type Route ¶
type Route struct {
// contains filtered or unexported fields
}
Route holds a match
func (*Route) AddRoute ¶
func (r *Route) AddRoute(opts ...RouteOptFn) *Route
AddRoute add a branch to this routing three
type RouteOptFn ¶
type RouteOptFn func(*Route)
func PrefixRoute ¶
func PrefixRoute(prefix string) RouteOptFn
PrefixRoute string prefix matching home. == home.matching
func RegExpRoute ¶
func RegExpRoute(re *regexp.Regexp) RouteOptFn
RegExpRoute regular expression based matching
func RouteHandler ¶
func RouteHandler(f Handler) RouteOptFn
RouteHandler set callback to execute if route matches
func RouteHandlerFunc ¶
func RouteHandlerFunc(f HandlerFunc) RouteOptFn
RouteHandlerFunc set callback to execute if route matches
func SimpleRoute ¶
func SimpleRoute(path string) RouteOptFn
SimpleRoute litral string matching ie: home.matching == home.matching
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router : Service Router
func (*Router) AddRoute ¶
func (r *Router) AddRoute(opts ...RouteOptFn) *Route
AddRoute add a new route
func (*Router) RootPrefix ¶
RootPrefix get root prefix configured for this router