<- Back to shtanton's homepage
aboutsummaryrefslogtreecommitdiff
path: root/main/pathfilter.go
diff options
context:
space:
mode:
authorCharlie Stanton <charlie@shtanton.xyz>2022-08-26 18:15:56 +0100
committerCharlie Stanton <charlie@shtanton.xyz>2022-08-26 18:15:56 +0100
commit094c9a8921fb5f54a34d8cdcb924b5dbacd336d8 (patch)
tree1ceb06246b2d5bd196746de7f300bdfe32a4a18a /main/pathfilter.go
parentce5c224211a94bfd4c898b51d15febdf2ed9d6f2 (diff)
downloadstred-go-094c9a8921fb5f54a34d8cdcb924b5dbacd336d8.tar
Adds a bunch of new path pattern features
- Bracketting in expressions - OR with | - Optional with ?
Diffstat (limited to 'main/pathfilter.go')
-rw-r--r--main/pathfilter.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/main/pathfilter.go b/main/pathfilter.go
index b64872e..7e21efe 100644
--- a/main/pathfilter.go
+++ b/main/pathfilter.go
@@ -12,10 +12,10 @@ func (filter AnySegmentPathFilter) accept() bool {
return false
}
-type GroupPathFilter struct {
- filters []PathFilterState
+type OrPathFilter struct {
+ filters [2]PathFilterState
}
-func (filter GroupPathFilter) eat(segment PathSegment) map[PathFilterState]struct{} {
+func (filter OrPathFilter) eat(segment PathSegment) map[PathFilterState]struct{} {
res := make(map[PathFilterState]struct{})
for _, f := range filter.filters {
for r := range f.eat(segment) {
@@ -24,7 +24,7 @@ func (filter GroupPathFilter) eat(segment PathSegment) map[PathFilterState]struc
}
return res
}
-func (filter GroupPathFilter) accept() bool {
+func (filter OrPathFilter) accept() bool {
for _, f := range filter.filters {
if f.accept() {
return true