macros into their own file, fix imports
parent
2b6886645b
commit
0b45f29319
|
@ -0,0 +1,25 @@
|
|||
macro_rules! upend_insert_val {
|
||||
($db_connection:expr, $entity:expr, $attribute:expr, $value:expr) => {{
|
||||
insert_entry(
|
||||
$db_connection,
|
||||
Entry {
|
||||
entity: $entity.clone(),
|
||||
attribute: String::from($attribute),
|
||||
value: crate::database::entry::EntryValue::Value(serde_json::Value::from($value)),
|
||||
},
|
||||
)?;
|
||||
}};
|
||||
}
|
||||
|
||||
macro_rules! upend_insert_addr {
|
||||
($db_connection:expr, $entity:expr, $attribute:expr, $addr:expr) => {{
|
||||
insert_entry(
|
||||
$db_connection,
|
||||
Entry {
|
||||
entity: $entity.clone(),
|
||||
attribute: String::from($attribute),
|
||||
value: crate::database::entry::EntryValue::Address($addr.clone()),
|
||||
},
|
||||
)?;
|
||||
}};
|
||||
}
|
|
@ -1,5 +1,8 @@
|
|||
#![macro_use]
|
||||
|
||||
#[macro_use]
|
||||
mod macros;
|
||||
|
||||
pub mod constants;
|
||||
pub mod entry;
|
||||
pub mod inner;
|
||||
|
@ -27,35 +30,6 @@ use std::fs;
|
|||
use std::path::{Path, PathBuf};
|
||||
use std::time::Duration;
|
||||
|
||||
#[macro_use]
|
||||
mod macros {
|
||||
macro_rules! upend_insert_val {
|
||||
($db_connection:expr, $entity:expr, $attribute:expr, $value:expr) => {{
|
||||
insert_entry(
|
||||
$db_connection,
|
||||
Entry {
|
||||
entity: $entity.clone(),
|
||||
attribute: String::from($attribute),
|
||||
value: EntryValue::Value(serde_json::Value::from($value)),
|
||||
},
|
||||
)?;
|
||||
}};
|
||||
}
|
||||
|
||||
macro_rules! upend_insert_addr {
|
||||
($db_connection:expr, $entity:expr, $attribute:expr, $addr:expr) => {{
|
||||
insert_entry(
|
||||
$db_connection,
|
||||
Entry {
|
||||
entity: $entity.clone(),
|
||||
attribute: String::from($attribute),
|
||||
value: EntryValue::Address($addr.clone()),
|
||||
},
|
||||
)?;
|
||||
}};
|
||||
}
|
||||
}
|
||||
|
||||
pub fn insert_file<C: Connection<Backend = Sqlite>>(
|
||||
connection: &C,
|
||||
file: models::NewFile,
|
||||
|
|
Loading…
Reference in New Issue