fixed resp count

This commit is contained in:
Josh Baker 2016-05-23 14:21:18 -07:00
parent afa15461de
commit 97332cc3e1
2 changed files with 12 additions and 4 deletions

View File

@ -14,6 +14,8 @@ import (
"github.com/tidwall/tile38/controller/server" "github.com/tidwall/tile38/controller/server"
) )
// MASSINSERT num_keys num_points [minx miny maxx maxy]
const useRandField = true const useRandField = true
func randMassInsertPosition(minLat, minLon, maxLat, maxLon float64) (float64, float64) { func randMassInsertPosition(minLat, minLon, maxLat, maxLon float64) (float64, float64) {

View File

@ -154,11 +154,17 @@ func (sw *scanWriter) writeFoot(cursor uint64) {
sw.wr.WriteString(`,"cursor":` + strconv.FormatUint(cursor, 10)) sw.wr.WriteString(`,"cursor":` + strconv.FormatUint(cursor, 10))
case server.RESP: case server.RESP:
sw.wr.Reset() sw.wr.Reset()
var data []byte
var err error
if sw.output == outputCount {
data, err = resp.IntegerValue(int(sw.count)).MarshalRESP()
} else {
values := []resp.Value{ values := []resp.Value{
resp.IntegerValue(int(cursor)), resp.IntegerValue(int(cursor)),
resp.ArrayValue(sw.values), resp.ArrayValue(sw.values),
} }
data, err := resp.ArrayValue(values).MarshalRESP() data, err = resp.ArrayValue(values).MarshalRESP()
}
if err != nil { if err != nil {
panic("Eek this is bad. Marshal resp should not fail.") panic("Eek this is bad. Marshal resp should not fail.")
} }