ЛР 2: закрыть уровень 4

Завершить PostgreSQL, Redis-сессии, миграции, таймауты и диагностику. Зафиксировать собственные тесты и доказательства финального прогона: 43 PASS, 0 FAIL, 0 SKIP; 768 HTTP-запросов без ошибок. Добавить официальный отчёт с запуском, архитектурой, SQL-планами и ограничениями. PR отложен до завершения уровня 5.
This commit is contained in:
2026-10-28 13:30:26 +03:00
parent 65003b6119
commit 834876c938
288 changed files with 107634 additions and 19 deletions
+21
View File
@@ -0,0 +1,21 @@
package database
import (
"context"
"github.com/jackc/pgx/v5/pgxpool"
)
func NewPostgres(ctx context.Context, databaseURL string) (*pgxpool.Pool, error) {
pool, err := pgxpool.New(ctx, databaseURL)
if err != nil {
return nil, err
}
if err = pool.Ping(ctx); err != nil {
pool.Close()
return nil, err
}
return pool, nil
}