File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed
Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -805,13 +805,7 @@ dictionary Condition {
805805// bdk_sqlite crate
806806// ------------------------------------------------------------------------
807807
808- interface Connection {
809- [Throws=SqliteError]
810- constructor(string path);
811-
812- [Name=new_in_memory, Throws=SqliteError]
813- constructor();
814- };
808+ typedef interface Connection;
815809
816810// ------------------------------------------------------------------------
817811// bdk crate - descriptor module
Original file line number Diff line number Diff line change @@ -5,19 +5,29 @@ use bdk_wallet::rusqlite::Connection as BdkConnection;
55use std:: sync:: Mutex ;
66use std:: sync:: MutexGuard ;
77
8+ /// A connection to a SQLite database.
9+ #[ derive( uniffi:: Object ) ]
810pub struct Connection ( Mutex < BdkConnection > ) ;
911
12+ #[ uniffi:: export]
1013impl Connection {
14+ /// Open a new connection to a SQLite database. If a database does not exist at the path, one is
15+ /// created.
16+ #[ uniffi:: constructor]
1117 pub fn new ( path : String ) -> Result < Self , SqliteError > {
1218 let connection = BdkConnection :: open ( path) ?;
1319 Ok ( Self ( Mutex :: new ( connection) ) )
1420 }
1521
22+ /// Open a new connection to an in-memory SQLite database.
23+ #[ uniffi:: constructor]
1624 pub fn new_in_memory ( ) -> Result < Self , SqliteError > {
1725 let connection = BdkConnection :: open_in_memory ( ) ?;
1826 Ok ( Self ( Mutex :: new ( connection) ) )
1927 }
28+ }
2029
30+ impl Connection {
2131 pub ( crate ) fn get_store ( & self ) -> MutexGuard < BdkConnection > {
2232 self . 0 . lock ( ) . expect ( "must lock" )
2333 }
You can’t perform that action at this time.
0 commit comments