Documentation ¶
Index ¶
- Constants
- Variables
- func HandleHeaders(ctxt *web.Context, ep EndPoint, h http.Handler) (served bool)
- func ServeOptions(methods []string, w http.ResponseWriter, r *http.Request, ...)
- func SetHeaderOrigin(w http.ResponseWriter, r *http.Request, origin map[string]string)
- type ContextHTTPHandler
- type ContextHTTPHandlerFunc
- type EndPoint
- type EndPointOrigin
- type Host
- type OptionsHandler
- type PathPrefix
- type RequestedEndPoint
- type Route
- type RouteMatcher
- type RouteMatcherFunc
- type Router
- type SunnyEndPoint
- func (se *SunnyEndPoint) AppendVarName(name ...string)
- func (se *SunnyEndPoint) DeleteHandler() http.Handler
- func (se *SunnyEndPoint) GetHandler() http.Handler
- func (se *SunnyEndPoint) GetRequestedEndPoint(r *http.Request, upath []string, data []string) *RequestedEndPoint
- func (se *SunnyEndPoint) Handler(method string) http.Handler
- func (se *SunnyEndPoint) Handlers() map[string]http.Handler
- func (se *SunnyEndPoint) HeadHandler() (head http.Handler)
- func (se *SunnyEndPoint) Methods() (methods []string)
- func (se *SunnyEndPoint) PatchHandler() http.Handler
- func (se *SunnyEndPoint) PostHandler() http.Handler
- func (se *SunnyEndPoint) PrependVarName(names ...string)
- func (se *SunnyEndPoint) PutHandler() http.Handler
- func (se *SunnyEndPoint) SetHandler(handler interface{}, method ...string) error
- type SunnyRoute
- func (sr *SunnyRoute) BuildRoute(p string) (varnames [][]string, rts []Route)
- func (sr *SunnyRoute) FindEndPoint(p []string, data []string) (EndPoint, []string, []string)
- func (sr *SunnyRoute) FindRequestedEndPoint(p string, r *http.Request) *RequestedEndPoint
- func (sr *SunnyRoute) Handle(p string, h interface{}, method ...string) (ep EndPoint)
- func (sr *SunnyRoute) HardEndPoint() EndPoint
- func (sr *SunnyRoute) HasRoute(p string) bool
- func (sr *SunnyRoute) SoftEndPoint() EndPoint
- func (sr *SunnyRoute) SplitPath(p string) (pathsplit []string)
- func (sr *SunnyRoute) Switch(p string) Switch
- type SunnyRouter
- func (sr *SunnyRouter) AddRouter(name string, rt Router) (ok bool)
- func (sr *SunnyRouter) CanRouteRequest(r *http.Request, value map[string]interface{}) (bool, map[string]interface{})
- func (sr *SunnyRouter) DelRouter(rt Router)
- func (sr *SunnyRouter) DelRouterByName(name string)
- func (sr *SunnyRouter) DeleteMatcher(name string)
- func (sr *SunnyRouter) FindRequestedEndPoint(value map[string]interface{}, r *http.Request) (Router, *RequestedEndPoint)
- func (sr *SunnyRouter) FullHost() string
- func (sr *SunnyRouter) FullHostCanon() string
- func (sr *SunnyRouter) FullPathPrefix() string
- func (sr *SunnyRouter) FullPathPrefixCanon() string
- func (sr *SunnyRouter) HasParent() bool
- func (sr *SunnyRouter) Host() string
- func (sr *SunnyRouter) HostCanon() string
- func (sr *SunnyRouter) MatchHost(r *http.Request, value map[string]interface{}) (bool, map[string]interface{})
- func (sr *SunnyRouter) MatchPathPrefix(r *http.Request, value map[string]interface{}) (bool, map[string]interface{})
- func (sr *SunnyRouter) Matcher(name string) RouteMatcher
- func (sr *SunnyRouter) Parent() Router
- func (sr *SunnyRouter) PathPrefix() string
- func (sr *SunnyRouter) PathPrefixCanon() string
- func (sr *SunnyRouter) ResetParent()
- func (sr *SunnyRouter) Router(name string) Router
- func (sr *SunnyRouter) Routers() map[string]Router
- func (sr *SunnyRouter) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (sr *SunnyRouter) ServeRequestedEndPoint(w http.ResponseWriter, r *http.Request, rep *RequestedEndPoint)
- func (sr *SunnyRouter) SetHost(host string, canon string)
- func (sr *SunnyRouter) SetMatcher(name string, rm RouteMatcher)
- func (sr *SunnyRouter) SetParent(rt Router) bool
- func (sr *SunnyRouter) SetPathPrefix(path string, canon string)
- func (sr *SunnyRouter) SubRouter(name string) (rt Router)
- type SunnySwitch
- type Switch
Constants ¶
View Source
const ( RouteHard RouteRegex RouteTyped RouteSoft )
View Source
const ( MatchtypeInt = iota MatchtypeInt64 MatchtypeFloat MatchtypeFloat64 )
Variables ¶
View Source
var ErrInvalidHandler = errors.New("invalid handler")
Functions ¶
func HandleHeaders ¶
func ServeOptions ¶
func SetHeaderOrigin ¶
Types ¶
type ContextHTTPHandler ¶
type ContextHTTPHandler struct {
web.ContextHandler
}
func (ContextHTTPHandler) ServeHTTP ¶
func (ch ContextHTTPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type ContextHTTPHandlerFunc ¶
func (ContextHTTPHandlerFunc) ServeContextHTTP ¶
func (f ContextHTTPHandlerFunc) ServeContextHTTP(ctxt *web.Context)
func (ContextHTTPHandlerFunc) ServeHTTP ¶
func (f ContextHTTPHandlerFunc) ServeHTTP(w http.ResponseWriter, r *http.Request)
type EndPoint ¶
type EndPoint interface { Handlers() map[string]http.Handler GetHandler() http.Handler PostHandler() http.Handler PutHandler() http.Handler PatchHandler() http.Handler DeleteHandler() http.Handler HeadHandler() http.Handler SetHandler(interface{}, ...string) error Methods() []string GetRequestedEndPoint(*http.Request, []string, []string) *RequestedEndPoint PrependVarName(...string) AppendVarName(...string) }
type EndPointOrigin ¶
type OptionsHandler ¶
type PathPrefix ¶
type RequestedEndPoint ¶
type Route ¶
type Route interface { HasRoute(string) bool FindRequestedEndPoint(p string, r *http.Request) *RequestedEndPoint FindEndPoint(p []string, data []string) (EndPoint, []string, []string) HardEndPoint() EndPoint SoftEndPoint() EndPoint Switch(string) Switch BuildRoute(string) ([][]string, []Route) Handle(string, interface{}, ...string) EndPoint }
type RouteMatcher ¶
type RouteMatcherFunc ¶
type Router ¶
type Router interface { CanRouteRequest(*http.Request, map[string]interface{}) (bool, map[string]interface{}) SetMatcher(name string, rm RouteMatcher) DeleteMatcher(name string) Matcher(name string) RouteMatcher SubRouter(string) Router AddRouter(string, Router) bool DelRouter(Router) DelRouterByName(string) SetParent(Router) bool ResetParent() Parent() Router HasParent() bool FindRequestedEndPoint(value map[string]interface{}, r *http.Request) (Router, *RequestedEndPoint) ServeHTTP(http.ResponseWriter, *http.Request) ServeRequestedEndPoint(http.ResponseWriter, *http.Request, *RequestedEndPoint) Handle(string, interface{}, ...string) EndPoint }
type SunnyEndPoint ¶
type SunnyEndPoint struct {
// contains filtered or unexported fields
}
func (*SunnyEndPoint) AppendVarName ¶
func (se *SunnyEndPoint) AppendVarName(name ...string)
func (*SunnyEndPoint) DeleteHandler ¶
func (se *SunnyEndPoint) DeleteHandler() http.Handler
func (*SunnyEndPoint) GetHandler ¶
func (se *SunnyEndPoint) GetHandler() http.Handler
func (*SunnyEndPoint) GetRequestedEndPoint ¶
func (se *SunnyEndPoint) GetRequestedEndPoint(r *http.Request, upath []string, data []string) *RequestedEndPoint
func (*SunnyEndPoint) HeadHandler ¶
func (se *SunnyEndPoint) HeadHandler() (head http.Handler)
func (*SunnyEndPoint) Methods ¶
func (se *SunnyEndPoint) Methods() (methods []string)
func (*SunnyEndPoint) PatchHandler ¶
func (se *SunnyEndPoint) PatchHandler() http.Handler
func (*SunnyEndPoint) PostHandler ¶
func (se *SunnyEndPoint) PostHandler() http.Handler
func (*SunnyEndPoint) PrependVarName ¶
func (se *SunnyEndPoint) PrependVarName(names ...string)
func (*SunnyEndPoint) PutHandler ¶
func (se *SunnyEndPoint) PutHandler() http.Handler
func (*SunnyEndPoint) SetHandler ¶
func (se *SunnyEndPoint) SetHandler(handler interface{}, method ...string) error
type SunnyRoute ¶
type SunnyRoute struct {
// contains filtered or unexported fields
}
func NewSunnyRoute ¶
func NewSunnyRoute() *SunnyRoute
func (*SunnyRoute) BuildRoute ¶
func (sr *SunnyRoute) BuildRoute(p string) (varnames [][]string, rts []Route)
func (*SunnyRoute) FindEndPoint ¶
func (*SunnyRoute) FindRequestedEndPoint ¶
func (sr *SunnyRoute) FindRequestedEndPoint(p string, r *http.Request) *RequestedEndPoint
func (*SunnyRoute) Handle ¶
func (sr *SunnyRoute) Handle(p string, h interface{}, method ...string) (ep EndPoint)
func (*SunnyRoute) HardEndPoint ¶
func (sr *SunnyRoute) HardEndPoint() EndPoint
func (*SunnyRoute) HasRoute ¶
func (sr *SunnyRoute) HasRoute(p string) bool
func (*SunnyRoute) SoftEndPoint ¶
func (sr *SunnyRoute) SoftEndPoint() EndPoint
func (*SunnyRoute) SplitPath ¶
func (sr *SunnyRoute) SplitPath(p string) (pathsplit []string)
func (*SunnyRoute) Switch ¶
func (sr *SunnyRoute) Switch(p string) Switch
type SunnyRouter ¶
type SunnyRouter struct { Route // contains filtered or unexported fields }
func NewSunnyRouter ¶
func NewSunnyRouter() *SunnyRouter
func (*SunnyRouter) CanRouteRequest ¶
func (*SunnyRouter) DelRouter ¶
func (sr *SunnyRouter) DelRouter(rt Router)
func (*SunnyRouter) DelRouterByName ¶
func (sr *SunnyRouter) DelRouterByName(name string)
func (*SunnyRouter) DeleteMatcher ¶
func (sr *SunnyRouter) DeleteMatcher(name string)
func (*SunnyRouter) FindRequestedEndPoint ¶
func (sr *SunnyRouter) FindRequestedEndPoint(value map[string]interface{}, r *http.Request) (Router, *RequestedEndPoint)
func (*SunnyRouter) FullHost ¶
func (sr *SunnyRouter) FullHost() string
func (*SunnyRouter) FullHostCanon ¶
func (sr *SunnyRouter) FullHostCanon() string
func (*SunnyRouter) FullPathPrefix ¶
func (sr *SunnyRouter) FullPathPrefix() string
func (*SunnyRouter) FullPathPrefixCanon ¶
func (sr *SunnyRouter) FullPathPrefixCanon() string
func (*SunnyRouter) HasParent ¶
func (sr *SunnyRouter) HasParent() bool
func (*SunnyRouter) Host ¶
func (sr *SunnyRouter) Host() string
func (*SunnyRouter) HostCanon ¶
func (sr *SunnyRouter) HostCanon() string
func (*SunnyRouter) MatchPathPrefix ¶
func (*SunnyRouter) Matcher ¶
func (sr *SunnyRouter) Matcher(name string) RouteMatcher
func (*SunnyRouter) Parent ¶
func (sr *SunnyRouter) Parent() Router
func (*SunnyRouter) PathPrefix ¶
func (sr *SunnyRouter) PathPrefix() string
func (*SunnyRouter) PathPrefixCanon ¶
func (sr *SunnyRouter) PathPrefixCanon() string
func (*SunnyRouter) ResetParent ¶
func (sr *SunnyRouter) ResetParent()
func (*SunnyRouter) Router ¶
func (sr *SunnyRouter) Router(name string) Router
func (*SunnyRouter) Routers ¶
func (sr *SunnyRouter) Routers() map[string]Router
func (*SunnyRouter) ServeHTTP ¶
func (sr *SunnyRouter) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*SunnyRouter) ServeRequestedEndPoint ¶
func (sr *SunnyRouter) ServeRequestedEndPoint(w http.ResponseWriter, r *http.Request, rep *RequestedEndPoint)
func (*SunnyRouter) SetHost ¶
func (sr *SunnyRouter) SetHost(host string, canon string)
func (*SunnyRouter) SetMatcher ¶
func (sr *SunnyRouter) SetMatcher(name string, rm RouteMatcher)
func (*SunnyRouter) SetParent ¶
func (sr *SunnyRouter) SetParent(rt Router) bool
func (*SunnyRouter) SetPathPrefix ¶
func (sr *SunnyRouter) SetPathPrefix(path string, canon string)
func (*SunnyRouter) SubRouter ¶
func (sr *SunnyRouter) SubRouter(name string) (rt Router)
type SunnySwitch ¶
type SunnySwitch struct { Route // contains filtered or unexported fields }
func (*SunnySwitch) PrependVarName ¶
func (ss *SunnySwitch) PrependVarName(names ...string)
func (*SunnySwitch) Switch ¶
func (ss *SunnySwitch) Switch(p string) (s Switch)
Click to show internal directories.
Click to hide internal directories.