mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-11 23:31:03 +00:00
use json:omitempty on Pair.Key
This commit is contained in:
parent
64e1b95910
commit
0ad65e64b7
2 changed files with 2 additions and 2 deletions
2
cache.go
2
cache.go
|
|
@ -314,7 +314,7 @@ func (p BitmapPairs) Less(i, j int) bool { return p[i].Count > p[j].Count }
|
|||
// Pair holds an id/count pair.
|
||||
type Pair struct {
|
||||
ID uint64 `json:"id"`
|
||||
Key string `json:"key"`
|
||||
Key string `json:"key,omitempty"`
|
||||
Count uint64 `json:"count"`
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -541,7 +541,7 @@ func TestHandler_Query_Pairs_JSON(t *testing.T) {
|
|||
h.ServeHTTP(w, test.MustNewHTTPRequest("POST", "/index/i/query", strings.NewReader(`TopN(frame=x, n=2)`)))
|
||||
if w.Code != http.StatusOK {
|
||||
t.Fatalf("unexpected status code: %d", w.Code)
|
||||
} else if body := w.Body.String(); body != `{"results":[[{"id":1,"key":"","count":2},{"id":3,"key":"","count":4}]]}`+"\n" {
|
||||
} else if body := w.Body.String(); body != `{"results":[[{"id":1,"count":2},{"id":3,"count":4}]]}`+"\n" {
|
||||
t.Fatalf("unexpected body: %q", body)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue