diff options
author | Akshay <[email protected]> | 2020-08-24 09:03:06 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2020-08-24 09:03:06 +0100 |
commit | 7308121fa3efc785bf964b8ab32505ba25513fdc (patch) | |
tree | e3d32a7adcbb66c65e20e9b3811e117c602969ba /src/db.rs | |
parent | 0e56a198c62ed9a9c1812cff1ffa618260535a35 (diff) |
add cli opts
Diffstat (limited to 'src/db.rs')
-rw-r--r-- | src/db.rs | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -9,7 +9,7 @@ use std::path::Path; | |||
9 | 9 | ||
10 | pub fn open_connection<P>(p: P) -> Result<Connection> | 10 | pub fn open_connection<P>(p: P) -> Result<Connection> |
11 | where | 11 | where |
12 | P: AsRef<Path> + fmt::Display, | 12 | P: AsRef<Path>, |
13 | { | 13 | { |
14 | info!("Opened connection to database"); | 14 | info!("Opened connection to database"); |
15 | Ok(Connection::open_with_flags( | 15 | Ok(Connection::open_with_flags( |
@@ -18,8 +18,8 @@ where | |||
18 | )?) | 18 | )?) |
19 | } | 19 | } |
20 | 20 | ||
21 | pub fn init_db<P: AsRef<Path> + fmt::Display>(p: P) -> Result<()> { | 21 | pub fn init_db<P: AsRef<Path> + fmt::Debug>(p: P) -> Result<()> { |
22 | debug!("Looking for database at `{}`", p); | 22 | debug!("Looking for database at `{:?}`", p); |
23 | let conn = open_connection(&p)?; | 23 | let conn = open_connection(&p)?; |
24 | conn.execute( | 24 | conn.execute( |
25 | "CREATE TABLE IF NOT EXISTS urls ( | 25 | "CREATE TABLE IF NOT EXISTS urls ( |
@@ -28,6 +28,6 @@ pub fn init_db<P: AsRef<Path> + fmt::Display>(p: P) -> Result<()> { | |||
28 | )", | 28 | )", |
29 | NO_PARAMS, | 29 | NO_PARAMS, |
30 | )?; | 30 | )?; |
31 | info!("SQLite3 database `{}` initialized", &p); | 31 | info!("SQLite3 database `{:?}` initialized", &p); |
32 | Ok(()) | 32 | Ok(()) |
33 | } | 33 | } |