Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: worked on dumping #14

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/database_drivers/libsql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,15 @@ impl DatabaseDriver for LibSQLDriver {

Box::pin(fut)
}

fn dump_database<'a>(
&'a mut self,
) -> Pin<Box<dyn Future<Output = Result<String, anyhow::Error>> + '_>> {
let fut = async move {
self.db.execute("").await?;
Ok("".to_string())
};

Box::pin(fut)
}
}
4 changes: 4 additions & 0 deletions src/database_drivers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ pub trait DatabaseDriver {
&'a mut self,
id: &'a str,
) -> Pin<Box<dyn Future<Output = Result<(), anyhow::Error>> + '_>>;

fn dump_database(
&mut self,
) -> Pin<Box<dyn Future<Output = Result<String, anyhow::Error>> + '_>>;
}

// Creates a new database driver based on the database_url
Expand Down
12 changes: 12 additions & 0 deletions src/database_drivers/mysql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,16 @@ impl DatabaseDriver for MySQLDriver {

Box::pin(fut)
}

fn dump_database(
&mut self,
) -> Pin<Box<dyn Future<Output = Result<String, anyhow::Error>> + '_>> {
let fut = async move {
sqlx::query("").execute(&mut self.db).await?;

Ok("".to_string())
};

Box::pin(fut)
}
}
Loading