// delete a single wallet based on wallet storage strategy
delete a single wallet based on wallet storage strategy
delete a single wallet based on wallet storage strategy
fn delete_wallet(&self, id: &str, config: &PostgresConfig, credentials: &PostgresCredentials) -> Result<(), WalletStorageError> {
        // if admin user and password aren't provided then bail
        if credentials.admin_account == None || credentials.admin_password == None {
            return Ok(());
        }
        let url_base = PostgresStorageType::_admin_postgres_url(&config, &credentials);
        let url = PostgresStorageType::_postgres_url(id, &config, &credentials);
        match postgres::Connection::connect(&url[..], config.tls()) {
            Ok(conn) => {
                for sql in &_DROP_SCHEMA {
                    match conn.execute(sql, &[]) {
                        Ok(_) => (),
                        Err(_) => ()
                    };
                }
                let _ret = conn.finish();
                ()
            }
            Err(_) => return Err(WalletStorageError::NotFound)
        };
        let conn = postgres::Connection::connect(url_base, config.tls())?;
        let drop_db_sql = str::replace(_DROP_WALLET_DATABASE, "$1", id);
        let ret = match conn.execute(&drop_db_sql, &[]) {
            Ok(_) => Ok(()),
            Err(_) => Ok(())
        };
        conn.finish()?;
        ret
    }
fn delete_wallet ( & self , id : & str , config : & PostgresConfig , credentials : & PostgresCredentials ) -> Result < ( ) , WalletStorageError > { // if admin user and password aren't provided then bail if credentials . admin_account == None || credentials . admin_password == None { return Ok ( ( ) ) ; } let url_base = PostgresStorageType :: _admin_postgres_url ( & config , & credentials ) ; let url = PostgresStorageType :: _postgres_url ( id , & config , & credentials ) ; match postgres :: Connection :: connect ( & url [ .. ] , config . tls ( ) ) { Ok ( conn ) => { for sql in & _DROP_SCHEMA { match conn . execute ( sql , & [ ] ) { Ok ( _ ) => ( ) , Err ( _ ) => ( ) } ; } let _ret = conn . finish ( ) ; ( ) } Err ( _ ) => return Err ( WalletStorageError :: NotFound ) } ; let conn = postgres :: Connection :: connect ( url_base , config . tls ( ) ) ? ; let drop_db_sql = str :: replace ( _DROP_WALLET_DATABASE , " " , id ) ; let ret = match conn . execute ( & drop_db_sql , & [ ] ) { Ok ( _ ) => Ok ( ( ) ) , Err ( _ ) => Ok ( ( ) ) } ; conn . finish ( ) ? ; ret }
delete a single wallet based on wallet storage strategy
delete a single wallet based on wallet storage strategy
&self
id
&str
config
&PostgresConfig
credentials
&PostgresCredentials