diff options
author | Franck Cuny <franck@lumberjaph.net> | 2013-04-21 15:34:41 -0700 |
---|---|---|
committer | Franck Cuny <franck@lumberjaph.net> | 2013-04-21 15:34:41 -0700 |
commit | 1f175ad1484c91a05323a1e66b946684bbafef17 (patch) | |
tree | 755a6bdfba6aae3e877c6bc0712e79226f650264 /route.go | |
parent | Small improvements (diff) | |
download | path-router-1f175ad1484c91a05323a1e66b946684bbafef17.tar.gz |
Rename the type fn to fns and add a real type fn
Diffstat (limited to 'route.go')
-rw-r--r-- | route.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/route.go b/route.go index b5c932d..768315e 100644 --- a/route.go +++ b/route.go @@ -5,11 +5,12 @@ import ( "strings" ) -type fn map[string]func(*Request) (Response, error) +type fn func(*Request) (Response, error) +type fns map[string]fn type Route struct { Path string - Executors fn + Executors fns Components []string RequiredNamedComponents map[string]bool OptionalNamedComponents map[string]bool @@ -74,7 +75,7 @@ func (self *Route) Execute(request *Request) (Response, error) { return code(request) } -func MakeRoute(path string, method string, code func(*Request) (Response, error)) Route { +func MakeRoute(path string, method string, code fn) Route { components := []string{} @@ -83,7 +84,7 @@ func MakeRoute(path string, method string, code func(*Request) (Response, error) } reqComponents, optComponents := getNamedComponents(components) - exec := fn{method: code} + exec := fns{method: code} route := Route{ Path: path, |