mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-07 11:27:50 +00:00
makeRows in gRPC hander now handles a bool result
This PR adds bool support to the makeRows function in the gRPC handler.
This commit is contained in:
parent
1fea1ea375
commit
7fd5248d98
2 changed files with 22 additions and 0 deletions
|
|
@ -535,6 +535,13 @@ func makeRows(resp pilosa.QueryResponse) chan *pb.RowResponse {
|
|||
Columns: []*pb.ColumnResponse{
|
||||
&pb.ColumnResponse{ColumnVal: &pb.ColumnResponse_Uint64Val{Uint64Val: uint64(r)}},
|
||||
}}
|
||||
case bool:
|
||||
ci := []*pb.ColumnInfo{{Name: "changed", Datatype: "bool"}}
|
||||
results <- &pb.RowResponse{
|
||||
Headers: ci,
|
||||
Columns: []*pb.ColumnResponse{
|
||||
&pb.ColumnResponse{ColumnVal: &pb.ColumnResponse_BoolVal{BoolVal: r}},
|
||||
}}
|
||||
default:
|
||||
log.Printf("unhandled %T\n", r)
|
||||
breakLoop = true
|
||||
|
|
|
|||
|
|
@ -204,6 +204,16 @@ func TestGRPC(t *testing.T) {
|
|||
{uint64(123)},
|
||||
},
|
||||
},
|
||||
// bool
|
||||
{
|
||||
true,
|
||||
[]expHeader{
|
||||
{"changed", "bool"},
|
||||
},
|
||||
[][]expColumn{
|
||||
{true},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for ti, test := range tests {
|
||||
|
|
@ -242,6 +252,11 @@ func TestGRPC(t *testing.T) {
|
|||
if val != v {
|
||||
t.Fatalf("test %d expected column val: %v, but got: %v", ti, v, val)
|
||||
}
|
||||
case bool:
|
||||
val := column.GetBoolVal()
|
||||
if val != v {
|
||||
t.Fatalf("test %d expected column val: %v, but got: %v", ti, v, val)
|
||||
}
|
||||
default:
|
||||
t.Fatalf("test %d has unhandled data type: %T", ti, v)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue