mirror of
https://github.com/aljazceru/cdk.git
synced 2025-12-22 23:25:22 +01:00
feat(cli): working dir
This commit is contained in:
@@ -5,21 +5,21 @@ pub enum Error {
|
||||
/// SQLX Error
|
||||
#[error(transparent)]
|
||||
SQLX(#[from] sqlx::Error),
|
||||
/// NUT02 Error
|
||||
/// Serde Error
|
||||
#[error(transparent)]
|
||||
Serde(#[from] serde_json::Error),
|
||||
/// NUT02 Error
|
||||
/// Wallet Error
|
||||
#[error(transparent)]
|
||||
CDKWallet(#[from] cdk::wallet::error::Error),
|
||||
/// NUT07 Error
|
||||
#[error(transparent)]
|
||||
CDKNUT07(#[from] cdk::nuts::nut07::Error),
|
||||
/// NUT02 Error
|
||||
#[error(transparent)]
|
||||
CDKNUT02(#[from] cdk::nuts::nut02::Error),
|
||||
/// NUT01 Error
|
||||
#[error(transparent)]
|
||||
CDKNUT01(#[from] cdk::nuts::nut01::Error),
|
||||
/// NUT02 Error
|
||||
#[error(transparent)]
|
||||
CDKNUT02(#[from] cdk::nuts::nut02::Error),
|
||||
/// NUT07 Error
|
||||
#[error(transparent)]
|
||||
CDKNUT07(#[from] cdk::nuts::nut07::Error),
|
||||
/// Secret Error
|
||||
#[error(transparent)]
|
||||
CDKSECRET(#[from] cdk::secret::Error),
|
||||
@@ -29,6 +29,9 @@ pub enum Error {
|
||||
/// Could Not Initialize Db
|
||||
#[error("Could not initialize Db")]
|
||||
CouldNotInitialize,
|
||||
/// Invalid Database Path
|
||||
#[error("Invalid database path")]
|
||||
InvalidDbPath,
|
||||
}
|
||||
|
||||
impl From<Error> for cdk::cdk_database::Error {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
//! SQLite Wallet Database
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::path::Path;
|
||||
use std::str::FromStr;
|
||||
|
||||
use async_trait::async_trait;
|
||||
@@ -25,7 +26,8 @@ pub struct WalletSQLiteDatabase {
|
||||
}
|
||||
|
||||
impl WalletSQLiteDatabase {
|
||||
pub async fn new(path: &str) -> Result<Self, Error> {
|
||||
pub async fn new(path: &Path) -> Result<Self, Error> {
|
||||
let path = path.to_str().ok_or(Error::InvalidDbPath)?;
|
||||
let _conn = SqliteConnectOptions::from_str(path)?
|
||||
.journal_mode(sqlx::sqlite::SqliteJournalMode::Wal)
|
||||
.read_only(false)
|
||||
|
||||
Reference in New Issue
Block a user