aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 32634e9..ac8d74e 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,2 +1,19 @@
pub mod sqlite;
pub mod yaml;
+
+
+pub fn insert(
+ dbconn: &mut rusqlite::Connection,
+ table_name: &str,
+ data: &mut [yaml_rust::Yaml],
+) {
+ let table_columns = crate::sqlite::get_column_names(&dbconn, table_name);
+
+ for mut doc in data {
+ let tx = dbconn.transaction().unwrap();
+
+ crate::yaml::extract(&mut doc, &tx, &table_columns);
+
+ tx.commit().unwrap();
+ }
+}