mirror of
https://github.com/kataras/iris.git
synced 2026-01-05 11:17:03 +00:00
preparing for the Iris control panel -- stay tuned when you hear my new project name 'cornea'
Former-commit-id: 8c0ada865ee17801efe90b197bf49bdbd55f636b
This commit is contained in:
@@ -13,21 +13,21 @@ import (
|
||||
// path, i.e the min as param name and 1 as the param argument.
|
||||
type Template struct {
|
||||
// Src is the original template given by the client
|
||||
Src string
|
||||
Params []TemplateParam
|
||||
Src string `json:"src"`
|
||||
Params []TemplateParam `json:"params"`
|
||||
}
|
||||
|
||||
// TemplateParam is the parsed macro parameter's template
|
||||
// they are being used to describe the param's syntax result.
|
||||
type TemplateParam struct {
|
||||
Src string // the unparsed param'false source
|
||||
Src string `json:"src"` // the unparsed param'false source
|
||||
// Type is not useful anywhere here but maybe
|
||||
// it's useful on host to decide how to convert the path template to specific router's syntax
|
||||
Type ast.ParamType
|
||||
Name string
|
||||
ErrCode int
|
||||
TypeEvaluator EvaluatorFunc
|
||||
Funcs []EvaluatorFunc
|
||||
Type ast.ParamType `json:"type"`
|
||||
Name string `json:"name"`
|
||||
ErrCode int `json:"errCode"`
|
||||
TypeEvaluator EvaluatorFunc `json:"-"`
|
||||
Funcs []EvaluatorFunc `json:"-"`
|
||||
}
|
||||
|
||||
// Parse takes a full route path and a macro map (macro map contains the macro types with their registered param functions)
|
||||
|
||||
@@ -12,24 +12,24 @@ import (
|
||||
// If any of the following fields are changed then the
|
||||
// caller should Refresh the router.
|
||||
type Route struct {
|
||||
Name string // "userRoute"
|
||||
Method string // "GET"
|
||||
Subdomain string // "admin."
|
||||
Name string `json:"name"` // "userRoute"
|
||||
Method string `json:"method"` // "GET"
|
||||
Subdomain string `json:"subdomain"` // "admin."
|
||||
tmpl *macro.Template // Tmpl().Src: "/api/user/{id:int}"
|
||||
Path string // "/api/user/:id"
|
||||
// temp storage, they're appended to the Handlers on build.
|
||||
// Execution happens before Handlers, can be empty.
|
||||
beginHandlers context.Handlers
|
||||
// Handlers are the main route's handlers, executed by order.
|
||||
// Cannot be empty.
|
||||
Handlers context.Handlers
|
||||
MainHandlerName string
|
||||
Handlers context.Handlers `json:"-"`
|
||||
MainHandlerName string `json:"mainHandlerName"`
|
||||
// temp storage, they're appended to the Handlers on build.
|
||||
// Execution happens after Begin and main Handler(s), can be empty.
|
||||
doneHandlers context.Handlers
|
||||
Path string `json:"path"` // "/api/user/:id"
|
||||
// FormattedPath all dynamic named parameters (if any) replaced with %v,
|
||||
// used by Application to validate param values of a Route based on its name.
|
||||
FormattedPath string
|
||||
FormattedPath string `json:"formattedPath"`
|
||||
}
|
||||
|
||||
// NewRoute returns a new route based on its method,
|
||||
|
||||
Reference in New Issue
Block a user