From 2f0b6720f447d3e4dfad777df015533431939900 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 12 May 2013 14:01:22 -0700 Subject: The Match type implement an interface. The "mapping" field that contains the map of elements in the path is now private and can be accesed via the RouteParams function. --- route.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/route.go b/route.go index 49d627d..6c41c95 100644 --- a/route.go +++ b/route.go @@ -25,7 +25,7 @@ type Route struct { type Match struct { Path string Route Route - Mapping map[string]string + mapping map[string]string Method string } @@ -34,6 +34,10 @@ var componentsIsOptional = regexp.MustCompile("^\\?{.*}$") var namedComponentsRegex = regexp.MustCompile("^{(.*)}$") var convertComponent = regexp.MustCompile("^\\??{(.*)}$") +func (self *Match) RouteParams() map[string]string { + return self.mapping +} + // XXX explain this function func (self *Route) convertComponentName(name string) string { newName := convertComponent.FindStringSubmatch(name) @@ -104,7 +108,7 @@ L: Path: strings.Join(components, "/"), Route: *self, Method: method, - Mapping: mapping, + mapping: mapping, } } -- cgit 1.4.1