Move column paths to support broader value types.

This commit is contained in:
Andrés N. Robalino
2019-11-01 16:19:46 -05:00
parent 1b784cb77a
commit 6ea8e42331
13 changed files with 201 additions and 123 deletions

View File

@ -44,7 +44,7 @@ impl WholeStreamCommand for Get {
}
}
pub type ColumnPath = Vec<Tagged<String>>;
pub type ColumnPath = Vec<Tagged<Value>>;
pub fn get_column_path(
path: &ColumnPath,
@ -67,7 +67,13 @@ pub fn get_column_path(
return ShellError::labeled_error_with_secondary(
"Row not found",
format!("There isn't a row indexed at '{}'", **column_path_tried),
format!(
"There isn't a row indexed at '{}'",
match &*column_path_tried {
Value::Primitive(primitive) => primitive.format(None),
_ => String::from(""),
}
),
column_path_tried.tag(),
format!("The table only has {} rows (0..{})", total, total - 1),
end_tag,