fix: prevent v1 shell hang on empty query result (#431)

This commit is contained in:
Andrew Lee 2022-07-27 15:21:49 -06:00 committed by GitHub
parent 0de05ed3e4
commit 182303e31d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 6 deletions

View File

@ -53,12 +53,13 @@ func NewModel(
serMax int,
scientific bool) Model {
cols := make([]table.Column, len(*res.Columns)+1)
colWidths := make([]int, len(*res.Columns)+1)
alignment := make([]lipgloss.Position, len(*res.Columns)+1)
rows := make([]table.Row, len(*res.Values))
colNames := *res.Columns
for rowI, row := range *res.Values {
oneColsLen := len(res.GetColumns()) + 1
cols := make([]table.Column, oneColsLen)
colWidths := make([]int, oneColsLen)
alignment := make([]lipgloss.Position, oneColsLen)
rows := make([]table.Row, len(res.GetValues()))
colNames := res.GetColumns()
for rowI, row := range res.GetValues() {
rd := table.RowData{}
rd["index"] = fmt.Sprintf("%d", rowI+1)
alignment[0] = lipgloss.Right

View File

@ -690,6 +690,10 @@ outer:
break
}
}
if len(allSeries) == 0 {
color.HiBlack("No results")
resIdx++
}
}
}