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
|
|
|
"context"
|
|
|
|
"log"
|
2020-04-08 19:20:23 +00:00
|
|
|
|
2024-06-05 17:36:34 +00:00
|
|
|
"github.com/jackc/pgx/v5"
|
2020-04-08 19:20:23 +00:00
|
|
|
)
|
|
|
|
|
2020-04-09 11:15:34 +00:00
|
|
|
func PGXOpen() {
|
|
|
|
ctx := context.Background()
|
|
|
|
conn, err := pgx.Connect(ctx, "postgres://pgx_md5:secret@localhost:5432/pgx_test")
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
defer conn.Close(ctx)
|
|
|
|
}
|