///
/// Creates the Postgres DB schema with the provided name in the id specified in the config file,
/// and initializes the encryption keys needed for encryption and decryption of data.
///
/// # Arguments
///
///  * `id` - name of the Postgres DB schema
///  * `config` - config containing the location of postgres db
///  * `credentials` - DB credentials
///  * `metadata` - encryption keys that need to be stored in the newly created DB
///
/// # Returns
///
/// Result that can be either:
///
///  * `()`
///  * `WalletStorageError`
///
/// # Errors
///
/// Any of the following `WalletStorageError` type_ of errors can be throw by this method:
///
///  * `AlreadyExists` - Schema with a given name already exists in the database
///  * `IOError("IO error during storage operation:...")` - Connection to the DB failed
///  * `IOError("Error occurred while creating wallet file:..)"` - Creation of schema failed
///  * `IOError("Error occurred while inserting the keys...")` - Insertion of keys failed
///
Creates the Postgres DB schema with the provided name in the id specified in the config file,
and initializes the encryption keys needed for encryption and decryption of data.
Creates the Postgres DB schema with the provided name in the id specified in the config file and initializes the encryption keys needed for encryption and decryption of data .
fn create_storage(&self, id: &str, config: Option<&str>, credentials: Option<&str>, metadata: &[u8]) -> Result<(), WalletStorageError> {
        let config = config
            .map(serde_json::from_str::<PostgresConfig>)
            .map_or(Ok(None), |v| v.map(Some))
            .map_err(|err| CommonError::InvalidStructure(format!("Cannot deserialize config: {:?}", err)))?;
        let credentials = credentials
            .map(serde_json::from_str::<PostgresCredentials>)
            .map_or(Ok(None), |v| v.map(Some))
            .map_err(|err| CommonError::InvalidStructure(format!("Cannot deserialize credentials: {:?}", err)))?;
        let config = match config {
            Some(config) => config,
            None => return Err(WalletStorageError::ConfigError)
        };
        let credentials = match credentials {
            Some(credentials) => credentials,
            None => return Err(WalletStorageError::ConfigError)
        };
        // initialize using the global selected_strategy object
        let r1 = SELECTED_STRATEGY.read().unwrap();
        r1.as_ref().create_wallet(id, &config, &credentials, metadata)
    }
fn create_storage ( & self , id : & str , config : Option < & str > , credentials : Option < & str > , metadata : & [ u8 ] ) -> Result < ( ) , WalletStorageError > { let config = config . map ( serde_json :: from_str :: < PostgresConfig > ) . map_or ( Ok ( None ) , | v | v . map ( Some ) ) . map_err ( | err | CommonError :: InvalidStructure ( format ! ( " " err ) ) ) ? ; let credentials = credentials . map ( serde_json :: from_str :: < PostgresCredentials > ) . map_or ( Ok ( None ) , | v | v . map ( Some ) ) . map_err ( | err | CommonError :: InvalidStructure ( format ! ( " " err ) ) ) ? ; let config = match config { Some ( config ) => config , None => return Err ( WalletStorageError :: ConfigError ) } ; let credentials = match credentials { Some ( credentials ) => credentials , None => return Err ( WalletStorageError :: ConfigError ) } ; // initialize using the global selected_strategy object let r1 = SELECTED_STRATEGY . read ( ) . unwrap ( ) ; r1 . as_ref ( ) . create_wallet ( id , & config , & credentials , metadata ) }
Creates the Postgres DB schema with the provided name in the id specified in the config file,
and initializes the encryption keys needed for encryption and decryption of data.
Creates the Postgres DB schema with the provided name in the id specified in the config file and initializes the encryption keys needed for encryption and decryption of data .
Result that can be either.

`()`
`WalletStorageError`
Result that can be either . ` () ` ` WalletStorageError `
&self
id
&str
config
Option<&str>
credentials
Option<&str>
metadata
&[u8]
errors
Any of the following `WalletStorageError` type_ of errors can be throw by this method.

`AlreadyExists` - Schema with a given name already exists in the database
`IOError("IO error during storage operation:...")` - Connection to the DB failed
`IOError("Error occurred while creating wallet file:..)"` - Creation of schema failed
`IOError("Error occurred while inserting the keys...")` - Insertion of keys failed
Any of the following ` WalletStorageError ` type_ of errors can be throw by this method . ` AlreadyExists ` - Schema with a given name already exists in the database ` IOError ( " IO error during storage operation : ... " ) ` - Connection to the DB failed ` IOError ( " Error occurred while creating wallet file : .. ) " ` - Creation of schema failed ` IOError ( " Error occurred while inserting the keys ... " ) ` - Insertion of keys failed