Golang helpers for Postgres.
go get github.com/neighborly/go-pghelpers
PostgresConfig
holds the information for postgres database connection. For example
var postgresConfig = pghelpers.PostgresConfig{
Host: "localhost",
Port: 5432,
Username: "postgres",
Password: "",
Database: "postgres",
}
pghelpers.ConnectPostgres
function returns db object and error if any. You can use pghelpers.ConnectPostgres
as follows
db, err := pghelpers.ConnectPostgres(postgresConfig)
GenerateAddress
returns a Postgres connection string, which can be used for sql.open()
.
addr := postgresConfig.GenerateAddress()
This project is licensed under the MIT License.