2020-04-09 11:15:34 +00:00
|
|
|
package open
|
|
|
|
|
2020-04-08 19:20:23 +00:00
|
|
|
import (
|
2020-04-09 11:15:34 +00:00
|
|
|
"database/sql"
|
|
|
|
"log"
|
2020-04-08 19:20:23 +00:00
|
|
|
|
2020-04-09 11:15:34 +00:00
|
|
|
_ "github.com/jackc/pgx/v4/stdlib"
|
2020-04-08 19:20:23 +00:00
|
|
|
)
|
|
|
|
|
2020-04-09 11:15:34 +00:00
|
|
|
func SQLOpen() {
|
|
|
|
db, err := sql.Open("pgx", "postgres://pgx_md5:secret@localhost:5432/pgx_test")
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
defer db.Close()
|
2020-04-08 19:20:23 +00:00
|
|
|
}
|