5fd833b108
dbschema.Query is used only for testing and sqlite, so this won't cause us problems in production. Change-Id: Ib296a7daf161a9d3de23a7dfdc4f505d47ac4a37
20 lines
497 B
Go
20 lines
497 B
Go
// Copyright (C) 2019 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
package pgutil
|
|
|
|
import (
|
|
"context"
|
|
"strconv"
|
|
|
|
"storj.io/storj/private/dbutil/dbschema"
|
|
)
|
|
|
|
// QueryData loads all data from tables
|
|
func QueryData(ctx context.Context, db dbschema.Queryer, schema *dbschema.Schema) (*dbschema.Data, error) {
|
|
return dbschema.QueryData(ctx, db, schema, func(columnName string) string {
|
|
quoted := strconv.Quote(columnName)
|
|
return `quote_nullable(` + quoted + `) as ` + quoted
|
|
})
|
|
}
|