gosora/router_gen/route_subset.go
Azareal 4d9dc76392 Begin work on making the analytics panes somewhat usable when having JavaScript disabled.
Very minor refactoring here and there across the software.
Save some allocations here and there.
2019-10-28 09:13:24 +10:00

33 lines
717 B
Go

package main
type RouteSubset struct {
RouteList []*RouteImpl
}
func (set *RouteSubset) Before(lines ...string) *RouteSubset {
for _, line := range lines {
for _, r := range set.RouteList {
r.RunBefore = append(r.RunBefore, Runnable{line, false})
}
}
return set
}
func (set *RouteSubset) LitBefore(lines ...string) *RouteSubset {
for _, line := range lines {
for _, r := range set.RouteList {
r.RunBefore = append(r.RunBefore, Runnable{line, true})
}
}
return set
}
func (set *RouteSubset) Not(path ...string) *RouteSubset {
for i, route := range set.RouteList {
if inStringList(route.Path, path) {
set.RouteList = append(set.RouteList[:i], set.RouteList[i+1:]...)
}
}
return set
}