Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes row count from str to int #10

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions cmd/row_count.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var (

type RowCount struct {
Table string `json:"Table"`
Rows string `json:"Rows"`
Rows int `json:"Rows"`
}

type connection struct {
Expand Down Expand Up @@ -76,10 +76,13 @@ func check_rows_in_db(source_creds vcap.Credentials) {
for _, joined_tables := range strings.Split(joined_tables, "\n") {
if joined_tables != "" {
s := strings.Split(joined_tables, " ")
rows = append(rows, &RowCount{Table: s[0], Rows: s[1]})
rows_as_int, err := strconv.Atoi(s[1])
if err != nil {
rows_as_int = -1
}
rows = append(rows, &RowCount{Table: s[0], Rows: rows_as_int})
}
}

// Raw json object of {"Table":"table_name","Rows":"#"}
raw, _ := json.Marshal(connection{RowsCountConnection: rows})
logging.Logger.Printf("%s", raw)
Expand Down
Loading