Skip to content

Commit

Permalink
Merge pull request #26 from ctrliq/fix-db-scan
Browse files Browse the repository at this point in the history
Fix regression with database result scan when using structure
  • Loading branch information
ikaneshiro authored Dec 13, 2023
2 parents d8d5739 + 2828748 commit 1ba1557
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions internal/plugins/static/pkg/staticdb/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (db *RepositoryDB) GetFileByTag(ctx context.Context, tag string) (*Reposito
if !rows.Next() {
return nil, fmt.Errorf("failed to retrieve file with tag %s", tag)
}
if err := rows.Scan(file); err != nil {
if err := rows.StructScan(file); err != nil {
return nil, err
}

Expand All @@ -149,7 +149,7 @@ func (db *RepositoryDB) GetFileByName(ctx context.Context, name string) (*Reposi
if !rows.Next() {
return nil, fmt.Errorf("failed to retrieve file %s", name)
}
if err := rows.Scan(file); err != nil {
if err := rows.StructScan(file); err != nil {
return nil, err
}

Expand Down
4 changes: 2 additions & 2 deletions internal/plugins/yum/pkg/yumdb/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func (db *RepositoryDB) GetPackage(ctx context.Context, id string) (*RepositoryP
if !rows.Next() {
return nil, fmt.Errorf("failed to retrieve package with id %s", id)
}
if err := rows.Scan(pkg); err != nil {
if err := rows.StructScan(pkg); err != nil {
return nil, err
}

Expand All @@ -173,7 +173,7 @@ func (db *RepositoryDB) GetPackageByTag(ctx context.Context, tag string) (*Repos
if !rows.Next() {
return nil, fmt.Errorf("failed to retrieve package with tag %s", tag)
}
if err := rows.Scan(pkg); err != nil {
if err := rows.StructScan(pkg); err != nil {
return nil, err
}

Expand Down
4 changes: 2 additions & 2 deletions internal/plugins/yum/pkg/yumdb/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ func (db *StatusDB) GetProperties(ctx context.Context) (*Properties, error) {
if !rows.Next() {
return nil, fmt.Errorf("failed to retrieve repository properties")
}
if err := rows.Scan(properties); err != nil {
if err := rows.StructScan(properties); err != nil {
return nil, err
}

Expand Down Expand Up @@ -300,7 +300,7 @@ func (db *StatusDB) GetReposync(ctx context.Context) (*Reposync, error) {
if !rows.Next() {
return nil, fmt.Errorf("failed to retrieve reposync data")
}
if err := rows.Scan(reposync); err != nil {
if err := rows.StructScan(reposync); err != nil {
return nil, err
}

Expand Down

0 comments on commit 1ba1557

Please sign in to comment.