snapshot of https://github.com/traggo/server.git (master, 2026-09-16; blobs > 131072B omitted)
Some checks failed
build / build (push) Failing after 3s

This commit is contained in:
upstream-mirror
2026-09-16 05:24:45 +05:00
commit cda7c1a474
272 changed files with 31973 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
package entry
import (
"fmt"
"github.com/traggo/server/model"
)
func tagsDuplicates(tags []model.DashboardTagFilter) error {
existingTags := make(map[model.DashboardTagFilter]struct{})
for _, tag := range tags {
if _, ok := existingTags[tag]; ok {
tagType := "exclude"
if tag.Include {
tagType = "include"
}
return fmt.Errorf("%s tags: tag '%s' is present multiple times", tagType, tag.Key+":"+tag.StringValue)
} else {
copyTag := tag
copyTag.Include = !copyTag.Include
if _, ok := existingTags[copyTag]; ok {
return fmt.Errorf("tag '%s' is present in both exclude tags and include tags", tag.Key+":"+tag.StringValue)
}
}
existingTags[tag] = struct{}{}
}
return nil
}