webhook configs for users, changes to system
Some checks are pending
check / check (push) Waiting to run
Some checks are pending
check / check (push) Waiting to run
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
// Package database manages PostgreSQL connection pools.
|
||||
package database
|
||||
|
||||
import (
|
||||
@@ -11,21 +10,21 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
// maxConnIdleSeconds is the maximum idle time for a connection.
|
||||
|
||||
maxConnIdleSeconds = 30
|
||||
// maxConnLifetimeMinutes is the maximum lifetime for a connection.
|
||||
|
||||
maxConnLifetimeMinutes = 5
|
||||
// connectTimeoutSeconds is the timeout for initial connection.
|
||||
|
||||
connectTimeoutSeconds = 10
|
||||
// maxConns is the maximum number of connections in the pool.
|
||||
|
||||
maxConns = 20
|
||||
// minConns is the minimum number of connections in the pool.
|
||||
|
||||
minConns = 2
|
||||
)
|
||||
|
||||
var pool *pgxpool.Pool //nolint:gochecknoglobals
|
||||
|
||||
// Connect establishes a PostgreSQL connection pool using the given DSN.
|
||||
// establishPostgreSQL connection pool using the given DSN.
|
||||
func Connect(dsn string) (*pgxpool.Pool, error) {
|
||||
cfg, err := pgxpool.ParseConfig(dsn)
|
||||
if err != nil {
|
||||
@@ -57,12 +56,10 @@ func Connect(dsn string) (*pgxpool.Pool, error) {
|
||||
return p, nil
|
||||
}
|
||||
|
||||
// Pool returns the global connection pool.
|
||||
func Pool() *pgxpool.Pool {
|
||||
return pool
|
||||
}
|
||||
|
||||
// Close closes the global connection pool.
|
||||
func Close() {
|
||||
if pool != nil {
|
||||
pool.Close()
|
||||
|
||||
Reference in New Issue
Block a user