1
0
mirror of https://github.com/astaxie/beego.git synced 2025-07-13 16:01:02 +00:00

change a log about new version

This commit is contained in:
astaxie
2013-09-10 00:00:11 +08:00
parent 5b9ae54441
commit bd61dd9ffc
14 changed files with 923 additions and 658 deletions

31
filter.go Normal file
View File

@ -0,0 +1,31 @@
package beego
import (
"regexp"
)
type FilterRouter struct {
pattern string
regex *regexp.Regexp
filterFunc FilterFunc
hasregex bool
}
func (mr *FilterRouter) ValidRouter(router string) bool {
if mr.pattern == "" {
return true
}
if router == mr.pattern {
return true
}
if mr.hasregex {
if mr.regex.MatchString(router) {
return true
}
matches := mr.regex.FindStringSubmatch(router)
if len(matches[0]) == len(router) {
return true
}
}
return false
}