func tableExists(dbName, tableName string) bool { sql := ` SELECT * FROM information_schema.tables WHERE table_schema='public' and table_catalog=$1 and table_name=$2; ` rows, err := getConnection().Query(sql, dbName, tableName) if err != nil { fmt.Println("Table Exists: ", err) } m := requests.ToMapping(rows) return len(m) == 1 }
func toJson(rows *sql.Rows) string { defer rows.Close() mapping := requests.ToMapping(rows) json := enc.ToIndentedJson(mapping, "", " ") return json }