@@ -56,7 +56,7 @@ impl WorkspaceDatabase {
5656 /// Create a new [DatabaseMeta] for the given database id and view id
5757 /// use [Self::update_database] to attach more views to the existing database.
5858 ///
59- pub fn add_database ( & mut self , database_id : & str , view_ids : Vec < String > ) {
59+ pub fn add_database ( & mut self , database_id : & str , view_ids : Vec < String > ) -> TransactionMut {
6060 let mut txn = self . collab . transact_mut ( ) ;
6161 let linked_views: HashSet < String > = view_ids. into_iter ( ) . collect ( ) ;
6262 let record = DatabaseMeta {
@@ -65,6 +65,7 @@ impl WorkspaceDatabase {
6565 linked_views : linked_views. into_iter ( ) . collect ( ) ,
6666 } ;
6767 self . body . push_back ( & mut txn, record) ;
68+ txn
6869 }
6970
7071 pub fn batch_add_database (
@@ -85,17 +86,21 @@ impl WorkspaceDatabase {
8586 }
8687
8788 /// Update the database by the given id
88- pub fn update_database ( & mut self , database_id : & str , f : impl FnMut ( & mut DatabaseMeta ) ) {
89- self
90- . body
91- . update_database ( & mut self . collab . transact_mut ( ) , database_id, f) ;
89+ pub fn update_database (
90+ & mut self ,
91+ database_id : & str ,
92+ f : impl FnMut ( & mut DatabaseMeta ) ,
93+ ) -> TransactionMut {
94+ let mut txn = self . collab . transact_mut ( ) ;
95+ self . body . update_database ( & mut txn, database_id, f) ;
96+ txn
9297 }
9398
9499 /// Delete the database by the given id
95- pub fn delete_database ( & mut self , database_id : & str ) {
96- self
97- . body
98- . delete_database ( & mut self . collab . transact_mut ( ) , database_id ) ;
100+ pub fn delete_database ( & mut self , database_id : & str ) -> TransactionMut {
101+ let mut txn = self . collab . transact_mut ( ) ;
102+ self . body . delete_database ( & mut txn , database_id ) ;
103+ txn
99104 }
100105
101106 /// Test if the database with the given id exists
0 commit comments