Documentation ¶
Index ¶
- Constants
- func SupportHistory() bool
- type Change
- type ChangeDynamic
- type Ctx
- func (ctx *Ctx) ChangeRoute(path string, replace bool)
- func (ctx *Ctx) ChangeRouteDynamic(name string, params, queries gas.Map, replace bool)
- func (ctx *Ctx) CustomPush(path string, replace bool)
- func (ctx *Ctx) CustomPushDynamic(name string, params, queries gas.Map, replace bool)
- func (ctx *Ctx) GetRouter() *gas.C
- func (ctx *Ctx) Init()
- func (ctx *Ctx) Link(to string, e gas.External) *gas.Element
- func (ctx *Ctx) LinkWithParams(name string, params, queries gas.Map, e gas.External) *gas.Element
- func (ctx *Ctx) Push(path string)
- func (ctx *Ctx) PushDynamic(name string, params, queries gas.Map)
- func (ctx *Ctx) Replace(path string)
- func (ctx *Ctx) ReplaceDynamic(name string, params, queries gas.Map)
- type Middleware
- type MiddlewareInfo
- type Route
- type RouteInfo
- type Settings
Constants ¶
View Source
const ChangeRouteEvent = "changeroute"
ChangeRouteEvent name for custom event
Variables ¶
This section is empty.
Functions ¶
func SupportHistory ¶
func SupportHistory() bool
SupportHistory return ture if browser support "HTML5 History API"
Types ¶
type Ctx ¶
type Ctx struct { Routes []Route Settings Settings This *routerComponent Before, After func(to, from *RouteInfo) error // contains filtered or unexported fields }
Ctx router context
func (*Ctx) ChangeRoute ¶
ChangeRoute change current route
func (*Ctx) ChangeRouteDynamic ¶
ChangeRouteDynamic change current route with params and queries
func (*Ctx) CustomPush ¶
func (*Ctx) CustomPushDynamic ¶
func (*Ctx) LinkWithParams ¶
LinkWithParams create link to route with queries and params
func (*Ctx) PushDynamic ¶
PushDynamic push user to another route with params and queries
type Middleware ¶
type Middleware func(info *MiddlewareInfo) (stop bool, err error)
type MiddlewareInfo ¶
type MiddlewareInfo struct {
To, From *RouteInfo
Change Change
ChangeDynamic ChangeDynamic
}
type Route ¶
type Route struct { Name string Path string Component func(info *RouteInfo) *gas.Component Exact bool Sensitive bool Redirect string RedirectName string // redirecting to route name RedirectParams gas.Map // pararms for rederecting to route RedirectQueries gas.Map // queries for rederecting to route Before, After Middleware Childes []Route }
Route information about route
Click to show internal directories.
Click to hide internal directories.