word change to string
Showing
1 changed file
with
2 additions
and
2 deletions
| ... | @@ -48,13 +48,13 @@ func (p *ControllerRegistor) Add(pattern string, c ControllerInterface) { | ... | @@ -48,13 +48,13 @@ func (p *ControllerRegistor) Add(pattern string, c ControllerInterface) { |
| 48 | expr = part[index:] | 48 | expr = part[index:] |
| 49 | part = part[:index] | 49 | part = part[:index] |
| 50 | //match /user/:id:int ([0-9]+) | 50 | //match /user/:id:int ([0-9]+) |
| 51 | //match /post/:username:word ([\w]+) | 51 | //match /post/:username:string ([\w]+) |
| 52 | } else if lindex := strings.LastIndex(part, ":"); lindex != 0 { | 52 | } else if lindex := strings.LastIndex(part, ":"); lindex != 0 { |
| 53 | switch part[lindex:] { | 53 | switch part[lindex:] { |
| 54 | case ":int": | 54 | case ":int": |
| 55 | expr = "([0-9]+)" | 55 | expr = "([0-9]+)" |
| 56 | part = part[:lindex] | 56 | part = part[:lindex] |
| 57 | case ":word": | 57 | case ":string": |
| 58 | expr = `([\w]+)` | 58 | expr = `([\w]+)` |
| 59 | part = part[:lindex] | 59 | part = part[:lindex] |
| 60 | } | 60 | } | ... | ... |
-
Please register or sign in to post a comment