redis: show results in query tab

This commit is contained in:
mappu 2024-06-23 15:57:33 +12:00
parent 8f105183eb
commit cc336366c9

View File

@ -180,8 +180,30 @@ func (ld *redisLoadedDatabase) ExecQuery(query string, resultArea *vcl.TListView
return return
} }
// Put ret into the data field somehow resultArea.SetEnabled(false)
fmt.Printf("result\n%#v\n", ret) resultArea.Clear()
resultArea.Columns().Clear()
colVal := resultArea.Columns().Add()
colVal.SetCaption("Result")
// The result is probably a single value or a string slice
switch ret := ret.(type) {
case []string:
// Multiple values
for _, single := range ret {
cell := resultArea.Items().Add()
cell.SetCaption(single) // formatUtf8
}
default:
// Single value
dataEntry := resultArea.Items().Add()
dataEntry.SetCaption(formatAny(ret)) // formatUtf8
}
resultArea.SetEnabled(true)
} }
func (ld *redisLoadedDatabase) Close() { func (ld *redisLoadedDatabase) Close() {