// 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> {
        // look to see if there is a specified db to use.  If not, use the default name
        let wallet_db_name: &str = get_multi_database_name(config);
        debug!("wallet_db_name: {:?}", wallet_db_name);
        let url = PostgresStorageType::_postgres_url(wallet_db_name, &config, &credentials);
        let conn = match postgres::Connection::connect(&url[..], config.tls()) {
            Ok(conn) => conn,
            Err(error) => {
                return Err(WalletStorageError::IOError(format!("Error occurred while connecting to wallet schema: {}", error)));
            }
        };
        let mut ret = Ok(());
        for sql in &_DELETE_WALLET_MULTI {
            ret = match conn.execute(sql, &[&id]) {
                Ok(row_count) => {
                    if row_count == 0 {
                        Err(WalletStorageError::NotFound)
                    } else {
                        Ok(())
                    }
                }
                Err(error) => {
                    Err(WalletStorageError::IOError(format!("Error occurred while deleting wallet: {}", error)))
                }
            }
        };
        conn.finish()?;
        return ret;
    }
fn delete_wallet ( & self , id : & str , config : & PostgresConfig , credentials : & PostgresCredentials ) -> Result < ( ) , WalletStorageError > { // look to see if there is a specified db to use.  If not, use the default name let wallet_db_name : & str = get_multi_database_name ( config ) ; debug ! ( " " wallet_db_name ) ; let url = PostgresStorageType :: _postgres_url ( wallet_db_name , & config , & credentials ) ; let conn = match postgres :: Connection :: connect ( & url [ .. ] , config . tls ( ) ) { Ok ( conn ) => conn , Err ( error ) => { return Err ( WalletStorageError :: IOError ( format ! ( " " error ) ) ) ; } } ; let mut ret = Ok ( ( ) ) ; for sql in & _DELETE_WALLET_MULTI { ret = match conn . execute ( sql , & [ & id ] ) { Ok ( row_count ) => { if row_count == 0 { Err ( WalletStorageError :: NotFound ) } else { Ok ( ( ) ) } } Err ( error ) => { Err ( WalletStorageError :: IOError ( format ! ( " " error ) ) ) } } } ; conn . finish ( ) ? ; return 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