Documentation ¶
Index ¶
- type Router
- func (r *Router) Error(code int, msg string) rterr.RouterError
- func (r *Router) GetRoute(name string) *routes.Route
- func (r *Router) HandlePath(path string)
- func (r *Router) Match(path string) (*routes.Route, vars.Vars, bool)
- func (r *Router) OnError(cb func(err error))
- func (r *Router) Redirect(path string)
- func (r *Router) RedirectNamed(name string, varMap vars.Vars)
- func (r *Router) Register(name, path string, callable func(v vars.Vars, u *url.URL)) *routes.Route
- func (r *Router) SkipTrailingSlash()
- func (r *Router) String() string
- func (r *Router) Throw(code int)
- func (r *Router) Use(middleware func(vars.Vars, *url.URL, *routes.Route, rterr.ErrorThrower) bool)
- type URLs
- func (u *URLs) Delete(key string)
- func (u *URLs) ForEach(f func(k string, elem *elements.Element), reverse ...bool)
- func (u *URLs) FromElements(raw bool, elems ...*elements.Element)
- func (u *URLs) FromMap(maps ...map[string]interface{})
- func (u *URLs) Get(key string) *elements.Element
- func (u *URLs) Hide(urlname ...string)
- func (u *URLs) InOrder(reverse ...bool) []*elements.Element
- func (u *URLs) Keys() []string
- func (u *URLs) Len() int
- func (u *URLs) Map() map[string]*elements.Element
- func (u *URLs) OnClick(f func(*elements.Element, jsext.Value))
- func (u *URLs) Set(key string, value *elements.Element, external ...bool)
- func (u *URLs) SetRaw(key string, value *elements.Element)
- func (u *URLs) Show(display string, urlname ...string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router is the main router struct.
func (*Router) Error ¶
func (r *Router) Error(code int, msg string) rterr.RouterError
Throw an error in the router with a message.
func (*Router) GetRoute ¶
Get a route by name. If it does not directly exist, it will search in the subroutes.
func (*Router) RedirectNamed ¶
Redirect to a route by name.
func (*Router) SkipTrailingSlash ¶
func (r *Router) SkipTrailingSlash()
SkipTrailingSlash will skip the trailing slash in the path.
type URLs ¶
type URLs struct {
// contains filtered or unexported fields
}
A url map element
func (*URLs) FromElements ¶
Fill up the URLs map from a slice of Elements
func (*URLs) FromMap ¶
Generate the urls from a slice of maps Each map has the following attributes:
- (string) name: the name of the url
- (string) href: the href of the url
- (string) text: the text of the url
- (bool) external: whether the url is external or not
- (bool) Hide: whether the url is hidden or not
- ([]string) class: the classes of the url (optional)
- (string) id: the id of the url (optional)
- ([]string) style: the style of the url (optional)
func (*URLs) OnClick ¶
On click action for URLs Takes a function that takes a URL element and the event.target | this
Click to show internal directories.
Click to hide internal directories.