2020-11-03 14:45:39 +00:00
|
|
|
// Copyright (C) 2020 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
package metabase
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/zeebo/errs"
|
|
|
|
|
2021-04-23 10:52:40 +01:00
|
|
|
"storj.io/private/tagsql"
|
2020-11-03 14:45:39 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func withRows(rows tagsql.Rows, err error) func(func(tagsql.Rows) error) error {
|
|
|
|
return func(callback func(tagsql.Rows) error) error {
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
err := callback(rows)
|
|
|
|
return errs.Combine(rows.Err(), rows.Close(), err)
|
|
|
|
}
|
|
|
|
}
|