diff --git a/postgresql/_example/main.go b/postgresql/_example/main.go index cd5d5ed94373454898c2d6c2d85fe7928d35e0ca..4ff87cba9983d12d5c533a074a2a872dd5358193 100644 --- a/postgresql/_example/main.go +++ b/postgresql/_example/main.go @@ -6,13 +6,13 @@ import ( "os" "time" - "upper.io/db" // Imports the main db package. - _ "upper.io/db/postgresql" // Imports the postgresql adapter. + "upper.io/db" // Imports the main db package. + "upper.io/db/postgresql" // Imports the postgresql adapter. ) -var settings = db.Settings{ +var settings = postgresql.ConnectionURL{ Database: `upperio_tests`, // Database name. - Host: `127.0.0.1`, + Address: db.ParseAddress(`127.0.0.1`), User: `upperio_tests`, // Database username. Password: `upperio_secret`, // Database password. } @@ -27,8 +27,8 @@ type Birthday struct { func main() { - if os.Getenv("TEST_HOST") != "" { - settings.Host = os.Getenv("TEST_HOST") + if addr := os.Getenv("TEST_HOST"); addr != "" { + settings.Address = db.ParseAddress(addr) } // Attemping to establish a connection to the database.