ЛР 5 — асинхронная обработка и версии pipeline

This commit is contained in:
2026-11-16 02:38:13 +03:00
parent 276dbdad8a
commit 1f535f1b5b
163 changed files with 17194 additions and 24 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
}