func ConnectAndExecute(uri string, dbFunc func(*sql.DB) error) (outerErr error) {
	pg, err := sql.Open("postgres", uri)
	if err == nil {
		err = pg.Ping()
	}
	if err != nil {
		return fmt.Errorf("%w: %v", derrors.NotFound, err)
	}
	defer func() {
		if err := pg.Close(); err != nil {
			outerErr = MultiErr{outerErr, err}
		}
	}()
	return dbFunc(pg)
}
// ConnectAndExecute connects to the postgres database specified by uri and
// executes dbFunc, then cleans up the database connection.
// It returns an error that Is derrors.NotFound if no connection could be made.
ConnectAndExecute connects to the postgres database specified by uri and
executes dbFunc, then cleans up the database connection.
It returns an error that Is derrors.NotFound if no connection could be made.
// ConnectAndExecute connects to the postgres database specified by uri and // executes dbFunc then cleans up the database connection . // It returns an error that Is derrors . NotFound if no connection could be made .
func ConnectAndExecute(uri string, dbFunc func(*sql.DB) error) (outerErr error) {
	pg, err := sql.Open("postgres", uri)
	if err == nil {
		err = pg.Ping()
	}
	if err != nil {
		return fmt.Errorf("%w: %v", derrors.NotFound, err)
	}
	defer func() {
		if err := pg.Close(); err != nil {
			outerErr = MultiErr{outerErr, err}
		}
	}()
	return dbFunc(pg)
}
func ConnectAndExecute ( uri string , dbFunc func ( * sql . DB ) error ) ( outerErr error ) { pg , err := sql . Open ( " " , uri ) if err == nil { err = pg . Ping ( ) } if err != nil { return fmt . Errorf ( " " , derrors . NotFound , err ) } defer func ( ) { if err := pg . Close ( ) ; err != nil { outerErr = MultiErr { outerErr , err } } } ( ) return dbFunc ( pg ) }
ConnectAndExecute connects to the postgres database specified by uri and
executes dbFunc, then cleans up the database connection.
ConnectAndExecute connects to the postgres database specified by uri and executes dbFunc then cleans up the database connection .