From 7bad8c950eef4dbf79bf5cbad3562405d7e22cb9 Mon Sep 17 00:00:00 2001 From: Charles Iliya Krempeaux Date: Fri, 21 Jun 2019 15:26:35 -0700 Subject: [PATCH] pathmatch.Pattern.Match() --- pattern_match.go | 23 +++++++++ pattern_match_test.go | 107 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 130 insertions(+) create mode 100644 pattern_match.go create mode 100644 pattern_match_test.go diff --git a/pattern_match.go b/pattern_match.go new file mode 100644 index 0000000..6db400f --- /dev/null +++ b/pattern_match.go @@ -0,0 +1,23 @@ +package pathmatch + +// Match returns true if ‘path’ matches the compiled pattern, else returns false if it doesn't match. +func (receiver *Pattern) Match(path string) (bool, error) { + if nil == receiver { + return false, errNilReceiver + } + +//@TODO: Is it a good idea to be dynamically creating this? +//@TODO: Also, can the struct fields be put in here directly instead? + args := []interface{}{} + numNames := len(receiver.MatchNames()) + for i:=0; i