gosora/router_gen/route_subset.go
Azareal 20bb909c54 Moving the files into subpackages 1/?
Moved more routes into the router generator.
Renamed a few of the routes.
Refactored the router generator.
Fixed PreRoute.

Began work on letting plugins plug into the template transpiler.
2017-11-10 03:33:11 +00:00

33 lines
741 B
Go

package main
type RouteSubset struct {
RouteList []*RouteImpl
}
func (set *RouteSubset) Before(lines ...string) *RouteSubset {
for _, line := range lines {
for _, route := range set.RouteList {
route.RunBefore = append(route.RunBefore, Runnable{line, false})
}
}
return set
}
func (set *RouteSubset) LitBefore(lines ...string) *RouteSubset {
for _, line := range lines {
for _, route := range set.RouteList {
route.RunBefore = append(route.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
}