Fix the insert command (#1815)

This commit is contained in:
Shaurya Shubham 2020-05-17 18:00:52 +05:30 committed by GitHub
parent e50db1a4de
commit 41e1aef369
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -50,24 +50,25 @@ fn insert(args: CommandArgs, registry: &CommandRegistry) -> Result<OutputStream,
let stream = async_stream! {
let (InsertArgs { column, value }, mut input) = args.process(&registry).await?;
match input.next().await {
Some(obj @ Value {
value: UntaggedValue::Row(_),
..
}) => match obj.insert_data_at_column_path(&column, value.clone()) {
Ok(v) => yield Ok(ReturnSuccess::Value(v)),
Err(err) => yield Err(err),
},
while let Some(row) = input.next().await {
match row {
Value {
value: UntaggedValue::Row(_),
..
} => match row.insert_data_at_column_path(&column, value.clone()) {
Ok(v) => yield Ok(ReturnSuccess::Value(v)),
Err(err) => yield Err(err),
},
Value { tag, ..} => {
yield Err(ShellError::labeled_error(
"Unrecognized type in stream",
"original value",
tag,
));
}
Some(Value { tag, ..}) => {
yield Err(ShellError::labeled_error(
"Unrecognized type in stream",
"original value",
tag,
));
}
None => {}
};
};