do the records

This commit is contained in:
amtoine 2023-03-11 12:04:05 +01:00
parent e354bb766d
commit c5fc7cd585
No known key found for this signature in database
GPG Key ID: 37AAE9B486CFF1AB

View File

@ -240,19 +240,22 @@ pub fn value_to_string(
for (col, val) in cols.iter().zip(vals) { for (col, val) in cols.iter().zip(vals) {
collection.push(if needs_quotes(col) { collection.push(if needs_quotes(col) {
format!( format!(
"\"{}\": {}", "{idt_po}\"{}\": {}",
col, col,
value_to_string_without_quotes(val, span, depth + 1, indent)? value_to_string_without_quotes(val, span, depth + 1, indent)?
) )
} else { } else {
format!( format!(
"{}: {}", "{idt_po}{}: {}",
col, col,
value_to_string_without_quotes(val, span, depth + 1, indent)? value_to_string_without_quotes(val, span, depth + 1, indent)?
) )
}); });
} }
Ok(format!("{{{}}}", collection.join(", "))) Ok(format!(
"{{{nl}{}{nl}{idt}}}",
collection.join(&format!(", {nl}").to_string())
))
} }
Value::LazyRecord { val, .. } => { Value::LazyRecord { val, .. } => {
let collected = val.collect()?; let collected = val.collect()?;