Exit if selected database does not have any tables
This commit is contained in:
parent
5551626516
commit
8dcb66d58c
12
main.go
12
main.go
@ -47,6 +47,18 @@ func initClient() {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tables, err := client.Tables()
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("Error:", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(tables) == 0 {
|
||||||
|
fmt.Println("Error: Database does not have any tables")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
dbClient = client
|
dbClient = client
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user