mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 18:18:03 +00:00
add Removed enum type to discard removed fields on parsing stage
This commit is contained in:
parent
f97d085934
commit
5c55615896
2 changed files with 5 additions and 0 deletions
|
@ -519,6 +519,9 @@ pub mod ordered_object {
|
|||
use serde::ser::SerializeMap;
|
||||
let mut map = serializer.serialize_map(Some(pairs.len()))?;
|
||||
for (k, v) in pairs {
|
||||
if let Val::Removed = v {
|
||||
continue;
|
||||
}
|
||||
map.serialize_entry(k, v)?;
|
||||
}
|
||||
map.end()
|
||||
|
|
|
@ -24,6 +24,7 @@ pub enum Val {
|
|||
Float(f64),
|
||||
String(String),
|
||||
Array(Vec<Val>),
|
||||
Removed,
|
||||
#[serde(with = "ordered_object")]
|
||||
Object(Vec<(String, Val)>),
|
||||
}
|
||||
|
@ -313,6 +314,7 @@ pub fn json_type(value: &OwnedValue, path: Option<&OwnedValue>) -> crate::Result
|
|||
Val::String(_) => "text",
|
||||
Val::Array(_) => "array",
|
||||
Val::Object(_) => "object",
|
||||
Val::Removed => unreachable!(),
|
||||
};
|
||||
|
||||
Ok(OwnedValue::Text(LimboText::json(Rc::new(val.to_string()))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue