Elimina Refinery y Barrel en favor de SeaORM
Se integran las funcionalidades de SeaORM en el funcionamiento de PageTop para abstraer el uso y acceso a la base de datos.
This commit is contained in:
parent
619b7b73c6
commit
4b5d8ce38a
16 changed files with 150 additions and 98 deletions
15
src/util.rs
15
src/util.rs
|
|
@ -9,15 +9,26 @@
|
|||
/// ];
|
||||
/// ```
|
||||
macro_rules! args {
|
||||
( $($key:expr => $value:expr),* ) => {{
|
||||
( $($KEY:expr => $VALUE:expr),* ) => {{
|
||||
let mut a = std::collections::HashMap::new();
|
||||
$(
|
||||
a.insert(String::from($key), $value.into());
|
||||
a.insert(String::from($KEY), $VALUE.into());
|
||||
)*
|
||||
a
|
||||
}};
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! db_migrations {
|
||||
( $DBCONN:ident ) => {{
|
||||
$crate::run_now({
|
||||
use $crate::db::migration::MigratorTrait;
|
||||
|
||||
migration::Migrator::up($DBCONN, None)
|
||||
})
|
||||
}};
|
||||
}
|
||||
|
||||
pub fn valid_id(id: &str) -> Option<String> {
|
||||
let id = id.trim().replace(" ", "_").to_lowercase();
|
||||
match id.is_empty() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue