diff options
author | Teddy Wing | 2021-05-29 19:20:46 +0200 |
---|---|---|
committer | Teddy Wing | 2021-05-29 19:20:46 +0200 |
commit | 9c2d269945af68e67d8daf8870be6d5664ab2153 (patch) | |
tree | 342eb952ac43ac7b28d97224160b8bb1ed71e5fd /src/database.rs | |
parent | c90d237d2d39c1deac5f92344d13160bc16f50b7 (diff) | |
download | reflectub-9c2d269945af68e67d8daf8870be6d5664ab2153.tar.bz2 |
Start setting up database interface
Diffstat (limited to 'src/database.rs')
-rw-r--r-- | src/database.rs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/database.rs b/src/database.rs new file mode 100644 index 0000000..1b00377 --- /dev/null +++ b/src/database.rs @@ -0,0 +1,37 @@ +use sqlx::{self, Connection}; + +use crate::github::Repo; + + +pub struct Db { + connection: sqlx::SqliteConnection, +} + +impl Db { + pub async fn connect( + path: &str, + ) -> Result<Self, Box<dyn std::error::Error>> { + Ok( + Db { + connection: sqlx::SqliteConnection::connect(path) + .await?, + } + ) + } + + pub fn create() -> Result<(), Box<dyn std::error::Error>> { + Ok(()) + } + + pub fn repo_insert(repo: &Repo) -> Result<(), Box<dyn std::error::Error>> { + Ok(()) + } + + pub fn repo_is_updated() -> Result<bool, Box<dyn std::error::Error>> { + Ok(false) + } + + pub fn repo_update(repo: &Repo) -> Result<(), Box<dyn std::error::Error>> { + Ok(()) + } +} |