2019-02-14 13:33:42 +00:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
package pgutil
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strconv"
|
|
|
|
|
2019-11-14 19:46:15 +00:00
|
|
|
"storj.io/storj/private/dbutil/dbschema"
|
2019-02-14 13:33:42 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// QueryData loads all data from tables
|
|
|
|
func QueryData(db dbschema.Queryer, schema *dbschema.Schema) (*dbschema.Data, error) {
|
|
|
|
return dbschema.QueryData(db, schema, func(columnName string) string {
|
|
|
|
quoted := strconv.Quote(columnName)
|
|
|
|
return `quote_nullable(` + quoted + `) as ` + quoted
|
|
|
|
})
|
|
|
|
}
|