Eliminate duplicate results
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
8366a2ce86
commit
acb71b873e
@ -98,7 +98,7 @@ func InsertPackage(db *sqlx.DB, pkg Package) error {
|
|||||||
|
|
||||||
// GetPkgs returns a result containing packages that match the where conditions
|
// GetPkgs returns a result containing packages that match the where conditions
|
||||||
func GetPkgs(db *sqlx.DB, where string, args ...any) (*sqlx.Rows, error) {
|
func GetPkgs(db *sqlx.DB, where string, args ...any) (*sqlx.Rows, error) {
|
||||||
stream, err := db.Queryx("SELECT * FROM pkgs, json_each(pkgs.provides) AS provides WHERE "+where, args...)
|
stream, err := db.Queryx("SELECT DISTINCT * FROM pkgs, json_each(pkgs.provides) AS provides WHERE "+where, args...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -108,7 +108,7 @@ func GetPkgs(db *sqlx.DB, where string, args ...any) (*sqlx.Rows, error) {
|
|||||||
// GetPkg returns a single package that match the where conditions
|
// GetPkg returns a single package that match the where conditions
|
||||||
func GetPkg(db *sqlx.DB, where string, args ...any) (*Package, error) {
|
func GetPkg(db *sqlx.DB, where string, args ...any) (*Package, error) {
|
||||||
out := &Package{}
|
out := &Package{}
|
||||||
err := db.Get(out, "SELECT * FROM pkgs, json_each(pkgs.provides) AS provides WHERE "+where+"LIMIT 1", args...)
|
err := db.Get(out, "SELECT DISTINCT * FROM pkgs, json_each(pkgs.provides) AS provides WHERE "+where+"LIMIT 1", args...)
|
||||||
return out, err
|
return out, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user