improve constraint matching, migration structure

This commit is contained in:
2026-06-25 13:52:56 +01:00
parent 95c8c6a839
commit 6e3ff81381
2 changed files with 77 additions and 45 deletions
+10 -2
View File
@@ -4,11 +4,19 @@ package version
type List []*Version
// Match tests versions against a constraint and returns a new List of matching versions only.
func (list List) Match(c *Constraint) List {
func (list List) Match(constraints ...*Constraint) List {
filtered := List{}
for _, v := range list {
if v.Match(c) {
ok := true
for _, c := range constraints {
if !v.Match(c) {
ok = false
break
}
}
if ok {
filtered = append(filtered, v)
}
}