summaryrefslogtreecommitdiff
path: root/events/wildcard.go
diff options
context:
space:
mode:
Diffstat (limited to 'events/wildcard.go')
-rw-r--r--events/wildcard.go43
1 files changed, 0 insertions, 43 deletions
diff --git a/events/wildcard.go b/events/wildcard.go
deleted file mode 100644
index b4c28ae1..00000000
--- a/events/wildcard.go
+++ /dev/null
@@ -1,43 +0,0 @@
-package events
-
-import (
- "strings"
-
- "github.com/spiral/errors"
-)
-
-type wildcard struct {
- prefix string
- suffix string
-}
-
-func newWildcard(pattern string) (*wildcard, error) {
- // Normalize
- origin := strings.ToLower(pattern)
- i := strings.IndexByte(origin, '*')
-
- /*
- http.*
- *
- *.WorkerError
- */
- if i == -1 {
- dotI := strings.IndexByte(pattern, '.')
-
- if dotI == -1 {
- // http.SuperEvent
- return nil, errors.Str("wrong wildcard, no * or . Usage: http.Event or *.Event or http.*")
- }
-
- return &wildcard{origin[0:dotI], origin[dotI+1:]}, nil
- }
-
- // pref: http.
- // suff: *
- return &wildcard{origin[0:i], origin[i+1:]}, nil
-}
-
-func (w wildcard) match(s string) bool {
- s = strings.ToLower(s)
- return len(s) >= len(w.prefix)+len(w.suffix) && strings.HasPrefix(s, w.prefix) && strings.HasSuffix(s, w.suffix)
-}