File size: 404 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
package main
import (
"context"
"fmt"
"github.com/jackc/pgx/v5"
)
func init() {
register(func(ctx context.Context, connStr string) error {
conn, err := pgx.Connect(ctx, connStr)
if err != nil {
return fmt.Errorf("connect: %w", err)
}
defer conn.Close(ctx)
err = conn.Ping(ctx)
if err != nil {
return fmt.Errorf("ping: %w", err)
}
return nil
}, "postgres", "postgresql")
}
|