File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ typedef struct {
4040 const char * encryption_key ;
4141 int sync_interval ;
4242 char with_webpki ;
43+ char offline ;
4344} libsql_config ;
4445
4546typedef const libsql_connection * libsql_connection_t ;
Original file line number Diff line number Diff line change @@ -97,6 +97,7 @@ pub unsafe extern "C" fn libsql_open_sync(
9797 encryption_key,
9898 sync_interval : 0 ,
9999 with_webpki : 0 ,
100+ offline : 0 ,
100101 } ;
101102 libsql_open_sync_with_config ( config, out_db, out_err_msg)
102103}
@@ -119,6 +120,7 @@ pub unsafe extern "C" fn libsql_open_sync_with_webpki(
119120 encryption_key,
120121 sync_interval : 0 ,
121122 with_webpki : 1 ,
123+ offline : 0 ,
122124 } ;
123125 libsql_open_sync_with_config ( config, out_db, out_err_msg)
124126}
@@ -256,7 +258,9 @@ pub unsafe extern "C" fn libsql_open_sync_with_config(
256258 return 100 ;
257259 }
258260 } ;
259- if let Some ( primary_url) = primary_url_with_offline_removed {
261+ let offline = config. offline != 0 || primary_url_with_offline_removed. is_some ( ) ;
262+ if offline {
263+ let primary_url = primary_url_with_offline_removed. unwrap_or ( primary_url. to_owned ( ) ) ;
260264 let mut builder =
261265 Builder :: new_synced_database ( db_path, primary_url. to_owned ( ) , auth_token. to_owned ( ) ) ;
262266 if config. with_webpki != 0 {
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ pub struct libsql_config {
1414 pub encryption_key : * const std:: ffi:: c_char ,
1515 pub sync_interval : std:: ffi:: c_int ,
1616 pub with_webpki : std:: ffi:: c_char ,
17+ pub offline : std:: ffi:: c_char ,
1718}
1819
1920#[ derive( Clone , Debug ) ]
You can’t perform that action at this time.
0 commit comments