diff --git a/Getting-started-with-pgx.md b/Getting-started-with-pgx.md index 8ff90da..7d00aab 100644 --- a/Getting-started-with-pgx.md +++ b/Getting-started-with-pgx.md @@ -44,6 +44,13 @@ $ go mod init hello go: creating new go.mod: module hello ``` +Add pgx to your Go modules: + +``` +$ go get github.com/jackc/pgx/v4 +go get: added github.com/jackc/pgx/v4 v4.11.0 +``` + ## Hello world from PostgreSQL Create the file `main.go` and copy and paste the following: @@ -89,13 +96,6 @@ $ go run main.go Hello, world! ``` -You may see some output from Go when it downloads pgx for the first time. - -``` -go: finding module for package github.com/jackc/pgx/v4 -go: found github.com/jackc/pgx/v4 in github.com/jackc/pgx/v4 v4.6.0 -``` - ## Using a Connection Pool The `*pgx.Conn` returned by `pgx.Connect()` represents a single connection and is not concurrency safe. This is entirely appropriate for a simple command line example such as above. However, for many uses, such as a web application server, concurrency is required. To use a connection pool replace the import `github.com/jackc/pgx/v4` with `github.com/jackc/pgx/v4/pgxpool` and connect with `pgxpool.Connect()` instead of `pgx.Connect()`.