shad-go/lectures/07-sql/open/sql.go
2020-04-09 14:15:54 +03:00

16 lines
241 B
Go

package open
import (
"database/sql"
"log"
_ "github.com/jackc/pgx/v4/stdlib"
)
func SQLOpen() {
db, err := sql.Open("pgx", "postgres://pgx_md5:secret@localhost:5432/pgx_test")
if err != nil {
log.Fatal(err)
}
defer db.Close()
}