first real functional version

This commit is contained in:
VC
2023-11-08 15:41:27 +01:00
parent bf70072376
commit b3ba8637f8
5 changed files with 55 additions and 9 deletions

View File

@@ -15,7 +15,7 @@ pub fn read_state(
conn: &Connection,
s: Option<u64>,
) -> Result<Option<TweetToToot>, Box<dyn Error>> {
debug!("Reading tweet_id {:?}", s);
debug!("Reading toot_id {:?}", s);
let query: String = match s {
Some(i) => format!("SELECT * FROM tweet_to_toot WHERE toot_id = {i}"),
None => "SELECT * FROM tweet_to_toot ORDER BY toot_id DESC LIMIT 1".to_string(),
@@ -49,7 +49,10 @@ pub fn write_state(conn: &Connection, t: TweetToToot) -> Result<(), Box<dyn Erro
/// Initiates the DB from path
pub fn init_db(d: &str) -> Result<(), Box<dyn Error>> {
debug!("Initializing DB for Scootaloo");
debug!(
"{}",
format!("Initializing DB for {}", env!("CARGO_PKG_NAME"))
);
let conn = Connection::open(d)?;
conn.execute(