MCPcopy Create free account
hub / github.com/AppFlowy-IO/AppFlowy-Collab / insert_sort

Method insert_sort

collab/src/database/database.rs:902–920  ·  view source on GitHub ↗
(&mut self, view_id: &str, sort: impl Into<SortMap>)

Source from the content-addressed store, hash-verified

900 }
901
902 pub fn insert_sort(&mut self, view_id: &str, sort: impl Into<SortMap>) {
903 let mut txn = self.collab.transact_mut();
904 if let Ok(view_id) = self.body.parse_view_id(view_id) {
905 self
906 .body
907 .views
908 .update_database_view(&mut txn, &view_id, |update| {
909 update.update_sorts(|txn, sort_update| {
910 let sort = sort.into();
911 if let Some(Any::String(sort_id)) = sort.get("id") {
912 let map_ref: MapRef = sort_update.upsert(txn, sort_id);
913 Any::from(sort).fill(txn, &map_ref).unwrap();
914 } else {
915 sort_update.push_back(txn, sort);
916 }
917 });
918 });
919 }
920 }
921
922 pub fn move_sort(&mut self, view_id: &str, from_sort_id: &str, to_sort_id: &str) {
923 let mut txn = self.collab.transact_mut();

Calls 8

transact_mutMethod · 0.80
parse_view_idMethod · 0.80
update_sortsMethod · 0.80
upsertMethod · 0.80
fillMethod · 0.80
push_backMethod · 0.80
update_database_viewMethod · 0.45
getMethod · 0.45