Use 'table' during internal->external (#898)

* Use 'table' during internal->external

* Preserve more of config
This commit is contained in:
JT
2022-01-31 07:52:05 -05:00
committed by GitHub
parent def5869c1c
commit d62716c83e
3 changed files with 52 additions and 29 deletions

View File

@ -178,10 +178,20 @@ impl Stack {
match config {
Ok(config) => config.into_config(),
Err(e) => {
println!("Can't find {} in {:?}", CONFIG_VARIABLE_ID, self);
Err(e)
Err(e) => Err(e),
}
}
pub fn update_config(&mut self, name: &str, value: Value) {
if let Some(Value::Record { cols, vals, .. }) = self.vars.get_mut(&CONFIG_VARIABLE_ID) {
for col_val in cols.iter().zip(vals.iter_mut()) {
if col_val.0 == name {
*col_val.1 = value;
return;
}
}
cols.push(name.to_string());
vals.push(value);
}
}

View File

@ -75,6 +75,10 @@ impl PipelineData {
self
}
pub fn is_nothing(&self) -> bool {
matches!(self, PipelineData::Value(Value::Nothing { .. }, ..))
}
pub fn into_value(self, span: Span) -> Value {
match self {
PipelineData::Value(Value::Nothing { .. }, ..) => Value::nothing(span),