Skip to content

Commit

Permalink
Add rudimentary support for rendering SQLRow typedesc (#1428)
Browse files Browse the repository at this point in the history
  • Loading branch information
1st1 authored and msullivan committed Dec 17, 2024
1 parent bb6e52e commit d9cbe72
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/outputs/tab_separated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ fn value_to_string(v: &Value) -> Result<String, anyhow::Error> {
| Object {..}
| SparseObject(..)
| NamedTuple {..}
| SQLRow {..}
| Array(_)
| Vector(_)
| Set(_)
Expand Down
8 changes: 8 additions & 0 deletions src/print/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,14 @@ impl FormatExt for Value {
}
Ok(())
}),
V::SQLRow { shape, fields } => prn.named_tuple(|prn| {
for (fld, value) in shape.elements.iter().zip(fields) {
prn.tuple_field(&fld.name)?;
value.format(prn)?;
prn.comma()?;
}
Ok(())
}),
V::Array(items) => prn.array(None, |prn| {
if let Some(limit) = prn.max_items() {
for item in &items[..min(limit, items.len())] {
Expand Down

0 comments on commit d9cbe72

Please sign in to comment.