MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / read_row

Method read_row

nodedb-crdt/src/state/core.rs:104–112  ·  view source on GitHub ↗

Read a single row's fields as a `LoroValue::Map`. Navigates via `LoroMap::get()` to avoid the expensive recursive `get_deep_value()` clone on the entire row container.

(&self, collection: &str, row_id: &str)

Source from the content-addressed store, hash-verified

102 /// Navigates via `LoroMap::get()` to avoid the expensive recursive
103 /// `get_deep_value()` clone on the entire row container.
104 pub fn read_row(&self, collection: &str, row_id: &str) -> Option<LoroValue> {
105 let coll = self.doc.get_map(collection);
106 match coll.get(row_id)? {
107 ValueOrContainer::Container(loro::Container::Map(m)) => Some(m.get_value()),
108 ValueOrContainer::Container(loro::Container::List(l)) => Some(l.get_value()),
109 ValueOrContainer::Container(_) => Some(LoroValue::Null),
110 ValueOrContainer::Value(v) => Some(v),
111 }
112 }
113
114 /// Read a single field from a row without cloning the entire row.
115 ///

Calls 2

get_valueMethod · 0.80
getMethod · 0.45