mirror of
https://github.com/nushell/nushell.git
synced 2025-08-12 09:00:17 +02:00
Fix to json
for SQLite databases (#8343)
Fixes #8341. The `CustomValue::to_json()` function is an odd duck; it defaults to returning `null`, and no `CustomValue` implementations override it to do anything useful. I forgot to implement `to_json()` for `SQLiteDatabase`, so `open foo.db | to json` was returning `null`. To fix this, I've removed `CustomValue::to_json()` and now `to json` will collect a `CustomValue` into a regular `Value` before doing a JSON conversion.
This commit is contained in:
@ -33,10 +33,6 @@ impl CustomValue for NuDataFrame {
|
||||
Ok(Value::List { vals, span })
|
||||
}
|
||||
|
||||
fn to_json(&self) -> nu_json::Value {
|
||||
nu_json::Value::Null
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &dyn std::any::Any {
|
||||
self
|
||||
}
|
||||
|
@ -34,10 +34,6 @@ impl CustomValue for NuExpression {
|
||||
Ok(self.to_value(span))
|
||||
}
|
||||
|
||||
fn to_json(&self) -> nu_json::Value {
|
||||
nu_json::Value::Null
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &dyn std::any::Any {
|
||||
self
|
||||
}
|
||||
|
@ -47,10 +47,6 @@ impl CustomValue for NuLazyFrame {
|
||||
Ok(Value::Record { cols, vals, span })
|
||||
}
|
||||
|
||||
fn to_json(&self) -> nu_json::Value {
|
||||
nu_json::Value::Null
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &dyn std::any::Any {
|
||||
self
|
||||
}
|
||||
|
@ -38,10 +38,6 @@ impl CustomValue for NuLazyGroupBy {
|
||||
Ok(Value::Record { cols, vals, span })
|
||||
}
|
||||
|
||||
fn to_json(&self) -> nu_json::Value {
|
||||
nu_json::Value::Null
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &dyn std::any::Any {
|
||||
self
|
||||
}
|
||||
|
@ -34,10 +34,6 @@ impl CustomValue for NuWhen {
|
||||
Ok(value)
|
||||
}
|
||||
|
||||
fn to_json(&self) -> nu_json::Value {
|
||||
nu_json::Value::Null
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &dyn std::any::Any {
|
||||
self
|
||||
}
|
||||
|
Reference in New Issue
Block a user