Skip to content

Instantly share code, notes, and snippets.

@shanev
Last active January 22, 2019 09:28
Show Gist options
  • Save shanev/2c4a324d8a56fd7e279a9d914f0de4a1 to your computer and use it in GitHub Desktop.
Save shanev/2c4a324d8a56fd7e279a9d914f0de4a1 to your computer and use it in GitHub Desktop.
// Client is a Postgres client.
// It wraps a pool of Postgres DB connections.
type Client struct {
*pg.DB
}
// NewDBClient creates a Postgres client
func NewDBClient(addr string, user string, password string, database string) *Client {
db := pg.Connect(&pg.Options{
Addr: addr,
User: user,
Password: password,
Database: database,
})
return &Client{db}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment