Реализация на 5

This commit is contained in:
Grbisba
2026-11-06 13:11:04 +03:00
parent 8d44c74535
commit 711754bbcd
27 changed files with 5999 additions and 116 deletions
+4 -4
View File
@@ -33,7 +33,7 @@ func addMaxConnectionsToCfg(cfg any, poolCfg *pgxpool.Config) {
}
}
func New(cfg MigrationConfig, afterConnect ...AfterConnect) (*pgxpool.Pool, error) {
func New(cfg MigrationConfig, afterConnect ...AfterConnect) *pgxpool.Pool {
lvl := getLevelFromConfig(cfg)
if len(afterConnect) == 0 {
@@ -43,7 +43,7 @@ func New(cfg MigrationConfig, afterConnect ...AfterConnect) (*pgxpool.Pool, erro
poolConfig, err := pgxpool.ParseConfig(cfg.GetURI())
if err != nil {
slog.Error("failed to parse postgres config", "error", err)
return nil, errParseConfig
panic(err)
}
addMaxConnectionsToCfg(cfg, poolConfig)
@@ -61,11 +61,11 @@ func New(cfg MigrationConfig, afterConnect ...AfterConnect) (*pgxpool.Pool, erro
pool, err := pgxpool.NewWithConfig(context.Background(), poolConfig)
if err != nil {
slog.Error("failed to create postgres pool", "error", err)
return nil, errCreatingPool
panic(err)
}
slog.Info("successfully connected to postgres pool")
return pool, nil
return pool
}
func load(afterConnects ...AfterConnect) func(ctx context.Context, conn *pgx.Conn) error {