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

Method insert_group_setting

collab/src/database/database.rs:831–849  ·  view source on GitHub ↗

Add a group setting to the view. If the setting already exists, it will be replaced.

(&mut self, view_id: &str, group_setting: impl Into<GroupSettingMap>)

Source from the content-addressed store, hash-verified

829
830 /// Add a group setting to the view. If the setting already exists, it will be replaced.
831 pub fn insert_group_setting(&mut self, view_id: &str, group_setting: impl Into<GroupSettingMap>) {
832 let mut txn = self.collab.transact_mut();
833 if let Ok(view_id) = self.body.parse_view_id(view_id) {
834 self
835 .body
836 .views
837 .update_database_view(&mut txn, &view_id, |update| {
838 update.update_groups(|txn, group_update| {
839 let group_setting = group_setting.into();
840 let settings = if let Some(Any::String(setting_id)) = group_setting.get("id") {
841 group_update.upsert(txn, setting_id)
842 } else {
843 group_update.push_back(txn, MapPrelim::default())
844 };
845 Any::from(group_setting).fill(txn, &settings).unwrap();
846 });
847 });
848 }
849 }
850
851 pub fn delete_group_setting(&mut self, view_id: &str, group_setting_id: &str) {
852 let mut txn = self.collab.transact_mut();

Calls 8

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