Split code into smaller parts within the auth package
This commit is contained in:
parent
6c0ddca8d0
commit
ea7286c875
3 changed files with 62 additions and 50 deletions
19
auth/regexp-utils.go
Normal file
19
auth/regexp-utils.go
Normal file
|
@ -0,0 +1,19 @@
|
|||
package auth
|
||||
|
||||
import "regexp"
|
||||
|
||||
type regexpSubmatcher struct {
|
||||
re *regexp.Regexp
|
||||
}
|
||||
|
||||
func (resm *regexpSubmatcher) getSubmatches(target string) map[string]string {
|
||||
matches := resm.re.FindStringSubmatch(target)
|
||||
l := len(matches)
|
||||
submatches := make(map[string]string, l)
|
||||
for i, name := range resm.re.SubexpNames() {
|
||||
if i > 0 && i <= l {
|
||||
submatches[name] = matches[i]
|
||||
}
|
||||
}
|
||||
return submatches
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue