/// For any given Zettel, insert the following:
///
/// - Entire zettel into the full text search table
/// - Extracted links into the links table
/// - Extracted tags into the tags table
/// - Extracted headers into the headers table
/// - High level metadata of zettels into the zettels table.
///
For any given Zettel, insert the following:
Entire zettel into the full text search table
Extracted links into the links table
Extracted tags into the tags table
Extracted headers into the headers table
High level metadata of zettels into the zettels table.
For any given Zettel insert the following : Entire zettel into the full text search table Extracted links into the links table Extracted tags into the tags table Extracted headers into the headers table High level metadata of zettels into the zettels table .
async fn add_to_db(
        conn: &mut SqliteConnection,
        zettels: Vec<ParserGatherer>,
    ) -> Result<(), anyhow::Error> {
        conn.execute("BEGIN").await?;
        for zettel in zettels {
            conn.execute(
                sqlx::query("INSERT OR REPLACE INTO full_text VALUES(?,?);")
                    .bind(&zettel.zettel_id)
                    .bind(&zettel.text),
            )
            .await?;
            conn.execute(
                sqlx::query("INSERT OR REPLACE INTO zettels VALUES(?,?,?,?);")
                    .bind(&zettel.zettel_id)
                    .bind(&zettel.timestamp)
                    .bind(&zettel.title)
                    .bind(&zettel.path.to_str()),
            )
            .await?;
            for (level, text) in zettel.headers {
                conn.execute(
                    sqlx::query("INSERT OR REPLACE INTO headers VALUES(?,?,?);")
                        .bind(&zettel.zettel_id)
                        .bind(level)
                        .bind(text),
                )
                .await?;
            }
            for tag in zettel.tags {
                conn.execute(
                    sqlx::query("INSERT OR REPLACE INTO tags VALUES(?,?);")
                        .bind(&zettel.zettel_id)
                        .bind(tag),
                )
                .await?;
            }
            for (label, link) in zettel.links {
                conn.execute(
                    sqlx::query("INSERT OR REPLACE INTO links VALUES(?,?,?);")
                        .bind(&zettel.zettel_id)
                        .bind(label)
                        .bind(link),
                )
                .await?;
            }
        }
        conn.execute("COMMIT").await?;
        Ok(())
    }
async fn add_to_db ( conn : & mut SqliteConnection , zettels : Vec < ParserGatherer > , ) -> Result < ( ) , anyhow :: Error > { conn . execute ( " " ) . await ? ; for zettel in zettels { conn . execute ( sqlx :: query ( " " ) . bind ( & zettel . zettel_id ) . bind ( & zettel . text ) , ) . await ? ; conn . execute ( sqlx :: query ( " " ) . bind ( & zettel . zettel_id ) . bind ( & zettel . timestamp ) . bind ( & zettel . title ) . bind ( & zettel . path . to_str ( ) ) , ) . await ? ; for ( level , text ) in zettel . headers { conn . execute ( sqlx :: query ( " " ) . bind ( & zettel . zettel_id ) . bind ( level ) . bind ( text ) , ) . await ? ; } for tag in zettel . tags { conn . execute ( sqlx :: query ( " " ) . bind ( & zettel . zettel_id ) . bind ( tag ) , ) . await ? ; } for ( label , link ) in zettel . links { conn . execute ( sqlx :: query ( " " ) . bind ( & zettel . zettel_id ) . bind ( label ) . bind ( link ) , ) . await ? ; } } conn . execute ( " " ) . await ? ; Ok ( ( ) ) }
For any given Zettel, insert the following:
 Entire zettel into the full text search table
 Extracted links into the links table
 Extracted tags into the tags table
 Extracted headers into the headers table
 High level metadata of zettels into the zettels table.
For any given Zettel insert the following : Entire zettel into the full text search table Extracted links into the links table Extracted tags into the tags table Extracted headers into the headers table High level metadata of zettels into the zettels table .
conn
&mut SqliteConnection
zettels
Vec<ParserGatherer>