diff options
author | Runxi Yu <me@runxiyu.org> | 2025-04-05 23:33:20 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-04-05 23:33:20 +0800 |
commit | b29061d0798ad854cd0f27ce60d7c58c10a239e9 (patch) | |
tree | b1892db8fe9b49cba1a6a48227144e0863257ae1 /internal | |
parent | Move trivial template functions into misc (diff) | |
download | forge-b29061d0798ad854cd0f27ce60d7c58c10a239e9.tar.gz forge-b29061d0798ad854cd0f27ce60d7c58c10a239e9.tar.zst forge-b29061d0798ad854cd0f27ce60d7c58c10a239e9.zip |
database: Separate opening the database into its own package
Diffstat (limited to 'internal')
-rw-r--r-- | internal/database/database.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/internal/database/database.go b/internal/database/database.go new file mode 100644 index 0000000..27c3b38 --- /dev/null +++ b/internal/database/database.go @@ -0,0 +1,16 @@ +package database + +import ( + "context" + + "github.com/jackc/pgx/v5/pgxpool" +) + +type Database struct { + *pgxpool.Pool +} + +func Open(connString string) (Database, error) { + db, err := pgxpool.New(context.Background(), connString) + return Database{db}, err +} |