We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e81b1b5 commit 85e64daCopy full SHA for 85e64da
docs/guides/using-go-and-pgx.rst
@@ -109,3 +109,25 @@ pgx types directly.
109
110
fmt.Println(author.Name)
111
}
112
+
113
+.. note::
114
+ For production applications, consider using pgxpool for connection pooling:
115
116
+ .. code-block:: go
117
118
+ import (
119
+ "github.com/jackc/pgx/v5/pgxpool"
120
+ "example.com/sqlc-tutorial/db"
121
+ )
122
123
+ func main() {
124
+ pool, err := pgxpool.New(context.Background(), os.Getenv("DATABASE_URL"))
125
+ if err != nil {
126
+ fmt.Fprintf(os.Stderr, "Unable to create connection pool: %v\n", err)
127
+ os.Exit(1)
128
+ }
129
+ defer pool.Close()
130
131
+ q := db.New(pool)
132
+ // Use q the same way as with single connections
133
0 commit comments