chore: simplify
This commit is contained in:
parent
8d8857cace
commit
ff090c9d68
@ -22,11 +22,7 @@ pub async fn open<T: AsRef<str>>(path: T) -> Result<SqlitePool, String> {
|
|||||||
|
|
||||||
pub async fn new<T: AsRef<str>>(path: T) -> Result<SqlitePool, String> {
|
pub async fn new<T: AsRef<str>>(path: T) -> Result<SqlitePool, String> {
|
||||||
std::fs::File::create_new(path.as_ref()).map_err(|e| e.to_string())?;
|
std::fs::File::create_new(path.as_ref()).map_err(|e| e.to_string())?;
|
||||||
let db_url = format!("sqlite://{}", path.as_ref());
|
open(path).await
|
||||||
|
|
||||||
SqlitePool::connect(&db_url)
|
|
||||||
.await
|
|
||||||
.map_err(|e| e.to_string())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn import_scripts(pool: &SqlitePool, scripts: Vec<Script>) -> Result<(), String> {
|
pub async fn import_scripts(pool: &SqlitePool, scripts: Vec<Script>) -> Result<(), String> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user