1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-09 13:05:56 +00:00

gofmt -s -w .

Former-commit-id: 6cca675303187f10377a7a713b2e7b3cdf16fd18
This commit is contained in:
kataras
2017-06-10 03:56:42 +03:00
parent c4f5fae561
commit 26c315cdb1
10 changed files with 58 additions and 8 deletions

View File

@@ -62,6 +62,8 @@ func (r *repository) getAll() []*Route {
return r.routes
}
// RoutesProvider should be implemented by
// iteral which contains the registered routes.
type RoutesProvider interface { // api builder
GetRoutes() []*Route
GetRoute(routeName string) *Route
@@ -177,6 +179,8 @@ func (rb *APIBuilder) Party(relativePath string, handlers ...context.Handler) Pa
}
}
// Macros returns the macro map which is responsible
// to register custom macro functions for all routes.
func (rb *APIBuilder) Macros() *macro.MacroMap {
return rb.macros
}

View File

@@ -70,6 +70,8 @@ func (h *routerHandler) addRoute(method, subdomain, path string, handlers contex
return nil
}
// NewDefaultHandler returns the handler which is responsible
// to map the request with a route (aka mux implementation).
func NewDefaultHandler() RequestHandler {
h := &routerHandler{}
return h

View File

@@ -588,7 +588,7 @@ func TypeByExtension(ext string) (typ string) {
return typ
}
// TypeByFilename, saem as TypeByExtension
// TypeByFilename same as TypeByExtension
// but receives a filename path instead.
func TypeByFilename(fullFilename string) string {
ext := filepath.Ext(fullFilename)

View File

@@ -12,6 +12,9 @@ import (
"github.com/kataras/iris/core/router/macro"
)
// Route contains the information about a registered Route.
// If any of the following fields are changed then the
// caller should Refresh the router.
type Route struct {
Name string // "userRoute"
Method string // "GET"
@@ -24,6 +27,11 @@ type Route struct {
FormattedPath string
}
// NewRoute returns a new route based on its method,
// subdomain, the path (unparsed or original),
// handlers and the macro container which all routes should share.
// It parses the path based on the "macros",
// handlers are being changed to validate the macros at serve time, if needed.
func NewRoute(method, subdomain, unparsedPath string,
handlers context.Handlers, macros *macro.MacroMap) (*Route, error) {

View File

@@ -12,6 +12,12 @@ import (
"github.com/kataras/iris/core/errors"
)
// Router is the "director".
// Caller should provide a request handler (router implementation or root handler).
// Router is responsible to build the received request handler and run it
// to serve requests, based on the received context.Pool.
//
// User can refresh the router with `RefreshRouter` whenever a route's field is changed by him.
type Router struct {
mu sync.Mutex // for Downgrade, WrapRouter & BuildRouter,
// not indeed but we don't to risk its usage by third-parties.