Verify that database name is specified when opening the connection
This commit is contained in:
parent
8ea8960696
commit
108754a8c3
@ -119,6 +119,11 @@ func NewFromUrl(url string, sshInfo *shared.SSHInfo) (*Client, error) {
|
|||||||
fmt.Println("Creating a new client for:", url)
|
fmt.Println("Creating a new client for:", url)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uri, err := neturl.Parse(url)
|
||||||
|
if err == nil && uri.Path == "" {
|
||||||
|
return nil, fmt.Errorf("Database name is not provided")
|
||||||
|
}
|
||||||
|
|
||||||
db, err := sqlx.Open("postgres", url)
|
db, err := sqlx.Open("postgres", url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
x
Reference in New Issue
Block a user