From 8dcb66d58c1e8cdaed2288af0cd431b34bdbc13e Mon Sep 17 00:00:00 2001 From: Dan Sosedoff Date: Sat, 11 Oct 2014 22:32:10 -0500 Subject: [PATCH] Exit if selected database does not have any tables --- main.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/main.go b/main.go index b17b7fa..bd4a250 100644 --- a/main.go +++ b/main.go @@ -47,6 +47,18 @@ func initClient() { 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 }