storj/internal/dbutil/pgutil/data.go
2019-02-14 15:33:42 +02:00

19 lines
461 B
Go

// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
package pgutil
import (
"strconv"
"storj.io/storj/internal/dbutil/dbschema"
)
// 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
})
}