mirror of https://github.com/tidwall/tile38.git
Fixed wrong order for fields with SCAN
This commit fixes an issue that happens when running SCAN on a collection that has objects with fields, causing field values to be mismatched with their respective keys. This only occured with json output, and is a regression from #534. Fixes #569
This commit is contained in:
parent
1477026721
commit
67abcefd25
|
@ -399,13 +399,14 @@ func (sw *scanWriter) writeObject(opts ScanWriterParams) bool {
|
|||
}
|
||||
|
||||
} else if len(sw.farr) > 0 {
|
||||
fvs := orderFields(sw.fmap, sw.farr, opts.fields)
|
||||
jsfields = `,"fields":[`
|
||||
for i := range sw.farr {
|
||||
for i, fv := range fvs {
|
||||
if i > 0 {
|
||||
jsfields += `,`
|
||||
}
|
||||
if len(opts.fields) > i {
|
||||
jsfields += strconv.FormatFloat(opts.fields[i], 'f', -1, 64)
|
||||
jsfields += strconv.FormatFloat(fv.value, 'f', -1, 64)
|
||||
} else {
|
||||
jsfields += "0"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue