feat: leveling system
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"time"
|
||||
"velox-bot/internal/config"
|
||||
|
||||
_ "github.com/jackc/pgx/v5/stdlib"
|
||||
)
|
||||
|
||||
func NewDB(config *config.Config) (*sql.DB, error) {
|
||||
pool, err := sql.Open("pgx", config.DBHost)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
pool.SetMaxIdleConns(10)
|
||||
pool.SetMaxOpenConns(100)
|
||||
pool.SetConnMaxLifetime(time.Hour)
|
||||
|
||||
if err := pool.Ping(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return pool, nil
|
||||
}
|
||||
Reference in New Issue
Block a user