Documentation ¶
Index ¶
- Constants
- func NewRoute() *route
- type MountedRouter
- func (ø *MountedRouter) MustURL(rt *route, params ...string) string
- func (ø *MountedRouter) MustURLMap(rt *route, params map[string]string) string
- func (ø *MountedRouter) MustURLStruct(rt *route, paramStruct interface{}, tagKey string) string
- func (ø *MountedRouter) Path() string
- func (ø *MountedRouter) Serve404(w http.ResponseWriter, r *http.Request)
- func (ø *MountedRouter) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (ø *MountedRouter) URL(rt *route, params ...string) (string, error)
- func (ø *MountedRouter) URLMap(rt *route, params map[string]string) (string, error)
- func (ø *MountedRouter) URLStruct(rt *route, paramStruct interface{}, tagKey string) (string, error)
- type PathLeaf
- type PathNode
- type Router
- func (r *Router) DELETE(path string, handler http.Handler) *route
- func (r *Router) GET(path string, handler http.Handler) *route
- func (ø *Router) Handle(path string, v verb, handler http.Handler) (*route, error)
- func (ø *Router) Mount(path string, m *http.ServeMux) (*MountedRouter, error)
- func (r *Router) MustHandle(path string, v verb, handler http.Handler) *route
- func (r *Router) MustMount(path string, m *http.ServeMux) *MountedRouter
- func (r *Router) OPTIONS(path string, handler http.Handler) *route
- func (r *Router) PATCH(path string, handler http.Handler) *route
- func (r *Router) POST(path string, handler http.Handler) *route
- func (r *Router) PUT(path string, handler http.Handler) *route
- func (ø *Router) ServeHTTP(w http.ResponseWriter, r *http.Request)
- type Vars
Constants ¶
View Source
const ( POST verb = 1 << iota GET PUT DELETE PATCH OPTIONS )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MountedRouter ¶
type MountedRouter struct { *PathNode NotFound http.Handler // contains filtered or unexported fields }
func MustMount ¶
func MustMount(path string, r *Router) *MountedRouter
func (*MountedRouter) MustURL ¶
func (ø *MountedRouter) MustURL(rt *route, params ...string) string
func (*MountedRouter) MustURLMap ¶
func (ø *MountedRouter) MustURLMap(rt *route, params map[string]string) string
func (*MountedRouter) MustURLStruct ¶
func (ø *MountedRouter) MustURLStruct(rt *route, paramStruct interface{}, tagKey string) string
func (*MountedRouter) Path ¶
func (ø *MountedRouter) Path() string
func (*MountedRouter) Serve404 ¶
func (ø *MountedRouter) Serve404(w http.ResponseWriter, r *http.Request)
func (*MountedRouter) ServeHTTP ¶
func (ø *MountedRouter) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*MountedRouter) URL ¶
func (ø *MountedRouter) URL(rt *route, params ...string) (string, error)
params are key/value pairs
type PathLeaf ¶
type PathLeaf struct {
// contains filtered or unexported fields
}
For the route /admin/forums/:forum_id:\d.*/suggestions/:suggestion_id:\d.* We'd have wildcards = ["forum_id", "suggestion_id"] For the route /admin/forums/:forum_id/suggestions/:suggestion_id:\d.* We'd have wildcards = ["forum_id", "suggestion_id"] For the route /admin/forums/:forum_id/suggestions/:suggestion_id We'd have wildcards = ["forum_id", "suggestion_id"]
func (PathLeaf) AddHandlerX ¶
Click to show internal directories.
Click to hide internal directories.