aboutsummaryrefslogtreecommitdiff
path: root/server.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-04-05 20:26:57 +0800
committerRunxi Yu <me@runxiyu.org>2025-04-05 20:26:57 +0800
commit20b4fe0c59357a433042732d46e38da9c3d14c3b (patch)
tree537d7d450701a839802b1d57a82bd07324dcba90 /server.go
parentmisc: Move utils.go's string function to misc (diff)
downloadforge-20b4fe0c59357a433042732d46e38da9c3d14c3b.tar.gz
forge-20b4fe0c59357a433042732d46e38da9c3d14c3b.tar.zst
forge-20b4fe0c59357a433042732d46e38da9c3d14c3b.zip
database shall no longer be a global variable
Diffstat (limited to 'server.go')
-rw-r--r--server.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/server.go b/server.go
index 8f35913..1113740 100644
--- a/server.go
+++ b/server.go
@@ -1,5 +1,12 @@
package main
+import "github.com/jackc/pgx/v5/pgxpool"
+
type server struct {
config Config
+
+ // database serves as the primary database handle for this entire application.
+ // Transactions or single reads may be used from it. A [pgxpool.Pool] is
+ // necessary to safely use pgx concurrently; pgx.Conn, etc. are insufficient.
+ database *pgxpool.Pool
}