in go/utils.go [181:205]
func PrettyPrintSQLRows(rows *sql.Rows, style string, render string, page int) {
t := table.NewWriter()
t.SetOutputMirror(os.Stdout)
if rows == nil {
return
}
columns, _ := rows.Columns()
for rows.Next() {
rawResult := make([][]byte, len(columns))
row := make([]interface{}, len(columns))
for i := range rawResult {
row[i] = &rawResult[i] // pointers to each string in the interface slice
}
// We don't consider malformed rows
_ = rows.Scan(row...)
s := make(table.Row, len(columns))
for i, cell := range rawResult {
s[i] = string(cell)
}
t.AppendRow(s)
}
t.SetPageSize(page)
t.SetStyle(getTableStyle(style))
renderTable(render, t)
}