mirror of https://github.com/tidwall/tile38.git
fixed resp count
This commit is contained in:
parent
afa15461de
commit
97332cc3e1
|
@ -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) {
|
||||||
|
|
|
@ -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()
|
||||||
values := []resp.Value{
|
var data []byte
|
||||||
resp.IntegerValue(int(cursor)),
|
var err error
|
||||||
resp.ArrayValue(sw.values),
|
if sw.output == outputCount {
|
||||||
|
data, err = resp.IntegerValue(int(sw.count)).MarshalRESP()
|
||||||
|
} else {
|
||||||
|
values := []resp.Value{
|
||||||
|
resp.IntegerValue(int(cursor)),
|
||||||
|
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.")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue