shad-go/lectures/07-sql/open/sql.go

12 lines
201 B
Go
Raw Normal View History

2020-04-08 19:20:23 +00:00
import (
"database/sql"
_ "github.com/jackc/pgx/v4/stdlib"
)
db, err := sql.Open("pgx", "postgres://pgx_md5:secret@localhost:5432/pgx_test")
if err != nil {
return err
}
defer db.Close()