package db import ( "database/sql" "fmt" "net/url" _ "github.com/lib/pq" "github.com/volker-raschek/go-logger/pkg/logger" ) var ( flogger = logger.NewSilentLogger() ) func New(storageEndpoint *url.URL) (Database, error) { newDBO, err := sql.Open(storageEndpoint.Scheme, storageEndpoint.String()) if err != nil { return nil, err } switch storageEndpoint.Scheme { case "postgres": return &Postgres{ dbo: newDBO, }, nil default: return nil, fmt.Errorf("Unknown Database Type") } } func SetLogger(logger logger.Logger) { flogger = logger }