mirror of
https://github.com/eduardolat/pgbackweb.git
synced 2026-01-25 22:18:51 -06:00
23 lines
433 B
Go
23 lines
433 B
Go
package databases
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
)
|
|
|
|
func (s *Service) TestDatabase(
|
|
ctx context.Context, version, connString string,
|
|
) error {
|
|
pgVersion, err := s.ints.PGDumpClient.ParseVersion(version)
|
|
if err != nil {
|
|
return fmt.Errorf("error parsing PostgreSQL version: %w", err)
|
|
}
|
|
|
|
err = s.ints.PGDumpClient.Ping(pgVersion, connString)
|
|
if err != nil {
|
|
return fmt.Errorf("error pinging database: %w", err)
|
|
}
|
|
|
|
return nil
|
|
}
|