MCPcopy
hub / github.com/autobrr/qui / openPostgresPool

Function openPostgresPool

internal/database/sqlite_to_postgres.go:240–250  ·  view source on GitHub ↗
(ctx context.Context, pgDSN string)

Source from the content-addressed store, hash-verified

238}
239
240func openPostgresPool(ctx context.Context, pgDSN string) (*pgxpool.Pool, error) {
241 pool, err := pgxpool.New(ctx, pgDSN)
242 if err != nil {
243 return nil, fmt.Errorf("open postgres pool: %w", err)
244 }
245 if err := pool.Ping(ctx); err != nil {
246 pool.Close()
247 return nil, fmt.Errorf("ping postgres: %w", err)
248 }
249 return pool, nil
250}
251
252func runDryRunReport(ctx context.Context, pool *pgxpool.Pool, tables []string, sqliteCounts map[string]int64) (*SQLiteToPostgresMigrationReport, error) {
253 return buildDryRunReport(ctx, pool, tables, sqliteCounts)

Callers 1

MigrateSQLiteToPostgresFunction · 0.85

Calls 2

PingMethod · 0.80
CloseMethod · 0.45

Tested by

no test coverage detected