fix(apb): export profile, remove dead code
This commit is contained in:
parent
6397647511
commit
8712b5e723
2 changed files with 1 additions and 47 deletions
|
@ -120,7 +120,7 @@ pub use types::{
|
|||
},
|
||||
document::{Document, DocumentMut, DocumentType},
|
||||
place::{Place, PlaceMut},
|
||||
// profile::Profile,
|
||||
profile::Profile,
|
||||
relationship::{Relationship, RelationshipMut},
|
||||
tombstone::{Tombstone, TombstoneMut},
|
||||
},
|
||||
|
|
|
@ -357,49 +357,3 @@ pub fn set_maybe_value(obj: &mut serde_json::Value, key: &str, value: Option<ser
|
|||
tracing::error!("error setting '{key}' on json Value: not an object");
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "unstructured")]
|
||||
pub(crate) trait InsertValue {
|
||||
fn insert_node(&mut self, k: &str, v: crate::Node<serde_json::Value>);
|
||||
fn insert_str(&mut self, k: &str, v: Option<&str>);
|
||||
fn insert_float(&mut self, k: &str, f: Option<f64>);
|
||||
fn insert_timestr(&mut self, k: &str, t: Option<chrono::DateTime<chrono::Utc>>);
|
||||
}
|
||||
|
||||
#[cfg(feature = "unstructured")]
|
||||
impl InsertValue for serde_json::Map<String, serde_json::Value> {
|
||||
fn insert_node(&mut self, k: &str, node: crate::Node<serde_json::Value>) {
|
||||
if !node.is_nothing() {
|
||||
self.insert(k.to_string(), node.into());
|
||||
}
|
||||
}
|
||||
|
||||
fn insert_str(&mut self, k: &str, v: Option<&str>) {
|
||||
if let Some(v) = v {
|
||||
self.insert(
|
||||
k.to_string(),
|
||||
serde_json::Value::String(v.to_string()),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
fn insert_float(&mut self, k: &str, v: Option<f64>) {
|
||||
if let Some(v) = v {
|
||||
if let Some(n) = serde_json::Number::from_f64(v) {
|
||||
self.insert(
|
||||
k.to_string(),
|
||||
serde_json::Value::Number(n),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn insert_timestr(&mut self, k: &str, t: Option<chrono::DateTime<chrono::Utc>>) {
|
||||
if let Some(published) = t {
|
||||
self.insert(
|
||||
k.to_string(),
|
||||
serde_json::Value::String(published.to_rfc3339()),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue