func verifyConnect(ctx context.Context, pool *db.Connection, hints string) error {
	err := pool.Connection.PingContext(ctx)
	if err == nil {
		return nil
	}

	dsn := createLoggingDSN(pool.Config)
	if isConnectionRefused(err) {
		header := "Network error:\n  Could not connect to database."
		return formatKnownError(header, hints, dsn)
	}

	pgxErrorMessage := getPGXErrorMessage(err)
	if pgxErrorMessage != nil {
		header := fmt.Sprintf("PostgreSQL error when connecting to the database:\n  %s", *pgxErrorMessage)
		return formatKnownError(header, hints, dsn)
	}

	errString := fmt.Sprintf("%+v", err)
	header := fmt.Sprintf("Unexpected PingContext() failure:\n%s", indentTwo(errString))
	return formatUnknownError(header, hints, dsn)
}
// verifyConnect verifies that the target database is actually running and the
// connection pool can actually connect.
verifyConnect verifies that the target database is actually running and the
connection pool can actually connect.
// verifyConnect verifies that the target database is actually running and the // connection pool can actually connect .
func verifyConnect(ctx context.Context, pool *db.Connection, hints string) error {
	err := pool.Connection.PingContext(ctx)
	if err == nil {
		return nil
	}
	dsn := createLoggingDSN(pool.Config)
	if isConnectionRefused(err) {
		header := "Network error:\n  Could not connect to database."
		return formatKnownError(header, hints, dsn)
	}
	pgxErrorMessage := getPGXErrorMessage(err)
	if pgxErrorMessage != nil {
		header := fmt.Sprintf("PostgreSQL error when connecting to the database:\n  %s", *pgxErrorMessage)
		return formatKnownError(header, hints, dsn)
	}
	errString := fmt.Sprintf("%+v", err)
	header := fmt.Sprintf("Unexpected PingContext() failure:\n%s", indentTwo(errString))
	return formatUnknownError(header, hints, dsn)
}
func verifyConnect ( ctx context . Context , pool * db . Connection , hints string ) error { err := pool . Connection . PingContext ( ctx ) if err == nil { return nil } dsn := createLoggingDSN ( pool . Config ) if isConnectionRefused ( err ) { header := " \n " return formatKnownError ( header , hints , dsn ) } pgxErrorMessage := getPGXErrorMessage ( err ) if pgxErrorMessage != nil { header := fmt . Sprintf ( " \n " , * pgxErrorMessage ) return formatKnownError ( header , hints , dsn ) } errString := fmt . Sprintf ( " " , err ) header := fmt . Sprintf ( " \n " , indentTwo ( errString ) ) return formatUnknownError ( header , hints , dsn ) }
verifyConnect verifies that the target database is actually running and the
connection pool can actually connect.
verifyConnect verifies that the target database is actually running and the connection pool can actually connect .