Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import "database/sql"
- import _ "github.com/lib/pq"
- connStr := fmt.Sprintf("postgres://%s:%s@localhost/%s?sslmode=disable", user, password, dbName)
- db, err := sql.Open("postgres", connStr)
- import "database/sql"
- import _ "github.com/lib/pq"
- connStr := fmt.Sprintf("user=%s password=%s dbname=%s sslmode=disable", user, password, dbName)
- db, err := sql.Open("postgres", connStr)
- if err != nil {
- log.Fatal(err)
- }
Add Comment
Please, Sign In to add comment