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)
| 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 | /// |