forked from extern/nushell
Dataframe feature for plugins (#3424)
This commit is contained in:
parent
9b8b1bad57
commit
f5fcf9d635
@ -159,7 +159,9 @@ dataframe = [
|
|||||||
"nu-protocol/dataframe",
|
"nu-protocol/dataframe",
|
||||||
"nu-command/dataframe",
|
"nu-command/dataframe",
|
||||||
"nu-value-ext/dataframe",
|
"nu-value-ext/dataframe",
|
||||||
"nu-data/dataframe"
|
"nu-data/dataframe",
|
||||||
|
"nu_plugin_post/dataframe",
|
||||||
|
"nu_plugin_to_bson/dataframe",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,4 +21,8 @@ serde_json = "1.0.57"
|
|||||||
surf = "1.0.3"
|
surf = "1.0.3"
|
||||||
url = "2.1.1"
|
url = "2.1.1"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
dataframe = ["nu-protocol/dataframe"]
|
||||||
|
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
|
@ -400,6 +400,14 @@ pub fn value_to_json_value(v: &Value) -> Result<serde_json::Value, ShellError> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
UntaggedValue::Table(l) => serde_json::Value::Array(json_list(l)?),
|
UntaggedValue::Table(l) => serde_json::Value::Array(json_list(l)?),
|
||||||
|
#[cfg(feature = "dataframe")]
|
||||||
|
UntaggedValue::Dataframe(_) => {
|
||||||
|
return Err(ShellError::labeled_error(
|
||||||
|
"Cannot convert dataframe",
|
||||||
|
"Cannot convert dataframe",
|
||||||
|
&v.tag,
|
||||||
|
))
|
||||||
|
}
|
||||||
UntaggedValue::Error(e) => return Err(e.clone()),
|
UntaggedValue::Error(e) => return Err(e.clone()),
|
||||||
UntaggedValue::Block(_) | UntaggedValue::Primitive(Primitive::Range(_)) => {
|
UntaggedValue::Block(_) | UntaggedValue::Primitive(Primitive::Range(_)) => {
|
||||||
serde_json::Value::Null
|
serde_json::Value::Null
|
||||||
|
@ -18,4 +18,7 @@ nu-source = { path = "../nu-source", version = "0.31.1" }
|
|||||||
nu-value-ext = { path = "../nu-value-ext", version = "0.31.1" }
|
nu-value-ext = { path = "../nu-value-ext", version = "0.31.1" }
|
||||||
num-traits = "0.2.14"
|
num-traits = "0.2.14"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
dataframe = ["nu-protocol/dataframe"]
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
|
@ -64,6 +64,8 @@ pub fn value_to_bson_value(v: &Value) -> Result<Bson, ShellError> {
|
|||||||
.collect::<Result<_, _>>()?,
|
.collect::<Result<_, _>>()?,
|
||||||
),
|
),
|
||||||
UntaggedValue::Block(_) | UntaggedValue::Primitive(Primitive::Range(_)) => Bson::Null,
|
UntaggedValue::Block(_) | UntaggedValue::Primitive(Primitive::Range(_)) => Bson::Null,
|
||||||
|
#[cfg(feature = "dataframe")]
|
||||||
|
UntaggedValue::Dataframe(_) => Bson::Null,
|
||||||
UntaggedValue::Error(e) => return Err(e.clone()),
|
UntaggedValue::Error(e) => return Err(e.clone()),
|
||||||
UntaggedValue::Primitive(Primitive::Binary(b)) => {
|
UntaggedValue::Primitive(Primitive::Binary(b)) => {
|
||||||
Bson::Binary(BinarySubtype::Generic, b.clone())
|
Bson::Binary(BinarySubtype::Generic, b.clone())
|
||||||
|
Loading…
Reference in New Issue
Block a user