bugfix, giving id to dependency resolver

This commit is contained in:
2025-10-11 21:00:22 -03:00
parent 97408da348
commit b58173837b
2 changed files with 6 additions and 14 deletions

View File

@@ -289,10 +289,6 @@ func GetDependencies(db *sql.DB, id string) (map[string]string, error) {
func ResolvDependencies(depnList map[string]string) ([]string, error) {
if len(depnList) > 0 {
return []string{}, nil
}
db, err := sql.Open("sqlite", consts.IndexDB)
if err != nil {
return []string{}, err
@@ -308,13 +304,13 @@ func ResolvDependencies(depnList map[string]string) ([]string, error) {
switch {
case strings.HasPrefix(constraint, ">"):
filter = fmt.Sprintf("AND serial > %s", value)
order = "ORDER BY serial ASC LIMIT 1"
order = "ORDER BY serial DESC LIMIT 1"
case strings.HasPrefix(constraint, "<="):
filter = fmt.Sprintf("AND serial <= %s", value)
order = "ORDER BY serial DESC LIMIT 1"
order = "ORDER BY serial ASC LIMIT 1"
case strings.HasPrefix(constraint, "<"):
filter = fmt.Sprintf("AND serial < %s", value)
order = "ORDER BY serial DESC LIMIT 1"
order = "ORDER BY serial ASC LIMIT 1"
case strings.HasPrefix(constraint, "="):
filter = fmt.Sprintf("AND serial = %s", value)
order = ""
@@ -331,7 +327,6 @@ func ResolvDependencies(depnList map[string]string) ([]string, error) {
}
resolved = append(resolved, packageId)
dp, err := GetDependencies(db, packageId)
if err != nil {
return resolved, err