From b29061d0798ad854cd0f27ce60d7c58c10a239e9 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sat, 5 Apr 2025 23:33:20 +0800 Subject: database: Separate opening the database into its own package --- server.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'server.go') diff --git a/server.go b/server.go index 6737ac6..90b2e2e 100644 --- a/server.go +++ b/server.go @@ -15,7 +15,7 @@ import ( "syscall" "time" - "github.com/jackc/pgx/v5/pgxpool" + "go.lindenii.runxiyu.org/forge/internal/database" "go.lindenii.runxiyu.org/lindenii-common/cmap" goSSH "golang.org/x/crypto/ssh" ) @@ -23,10 +23,7 @@ import ( 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 + database database.Database sourceHandler http.Handler staticHandler http.Handler -- cgit v1.2.3