Improve tags performance (#1526)

Co-authored-by: Erik De Neve <erik.de.neve@telenet.be>
This commit is contained in:
Alexander Zobnin
2023-03-21 12:16:44 +01:00
parent 07c02ca97a
commit dd6798834a
9 changed files with 194 additions and 106 deletions

View File

@@ -88,6 +88,11 @@ func parseFilter(filter string) (*regexp2.Regexp, error) {
return regexp2.Compile(pattern, regexp2.RE2)
}
func isRegex(filter string) bool {
regex := regexp.MustCompile(`^/(.+)/([imncsxrde]*)$`)
return regex.MatchString(filter)
}
func itemTagToString(tag ItemTag) string {
if tag.Value != "" {
return fmt.Sprintf("%s: %s", tag.Tag, tag.Value)