Updated
On this page
Package dbutil rewrites PostgreSQL connection URLs to retarget the database, used when creating, dropping, or connecting to the maintenance database.
#internal/dbutil
#internal/dbutil
#SwapDatabase
go
func SwapDatabase(dbURL, newDB string) (string, error)SwapDatabase rewrites a PostgreSQL connection URL to target a different database. Example: SwapDatabase("postgres://localhost:5432/myapp", "otherdb") returns "postgres://localhost:5432/otherdb"
#MaintenanceURL
go
func MaintenanceURL(dbURL string) (string, error)MaintenanceURL rewrites a PostgreSQL connection URL to target the 'postgres' maintenance database.