dbNameFromConnectionURL returns the database name from the given connection URL, where connectionURL is of the form postgres://user:pass@host:port/dbname
(t testing.TB, connectionURL string)
| 165 | // dbNameFromConnectionURL returns the database name from the given connection URL, |
| 166 | // where connectionURL is of the form postgres://user:pass@host:port/dbname |
| 167 | func dbNameFromConnectionURL(t testing.TB, connectionURL string) string { |
| 168 | u, err := url.Parse(connectionURL) |
| 169 | require.NoError(t, err) |
| 170 | return strings.TrimPrefix(u.Path, "/") |
| 171 | } |
| 172 | |
| 173 | // DumpOnFailure exports the database referenced by connectionURL to a file |
| 174 | // corresponding to the current test, with a suffix indicating the time the |