macros pls work

This commit is contained in:
2023-08-29 21:34:01 +02:00
parent 8ea074e872
commit 45a25a49cc
3 changed files with 88 additions and 13 deletions

View File

@@ -13,11 +13,29 @@ use serde::{Deserialize, Serialize};
use time;
use uuid::Uuid;
macro_rules! build_state_query {
() => {
println!("hi")
};
}
// #[macro_use]
// mod macros {
// macro_rules! build_state_query {
// ($pool:expr, $state_name:literal, $value:expr, $trip_id:expr, $item_id:expr, $user_id:expr) => {
// crate::execute!(
// &sqlite::QueryClassification {
// query_type: sqlite::QueryType::Update,
// component: sqlite::Component::Trips,
// },
// $pool,
// ["UPDATE trips_items SET pick = ?
// WHERE trip_id = ?
// AND item_id = ?
// AND user_id = "
// ,"?"]
// $value,
// $trip_id,
// $item_id,
// $user_id
// )
// };
// }
// }
#[derive(sqlite::Type, PartialEq, PartialOrd, Deserialize, Debug)]
pub enum TripState {
@@ -384,11 +402,11 @@ impl TripItem {
crate::execute!(
&sqlite::QueryClassification {
query_type: sqlite::QueryType::Update,
component: sqlite::Component::Inventory,
component: sqlite::Component::Trips,
},
pool,
"UPDATE trips_items
SET pick = ?
SET " => "pick" => "= ?
WHERE trip_id = ?
AND item_id = ?
AND user_id = ?",
@@ -403,7 +421,7 @@ impl TripItem {
crate::execute!(
&sqlite::QueryClassification {
query_type: sqlite::QueryType::Update,
component: sqlite::Component::Inventory,
component: sqlite::Component::Trips,
},
pool,
"UPDATE trips_items
@@ -422,7 +440,7 @@ impl TripItem {
crate::execute!(
&sqlite::QueryClassification {
query_type: sqlite::QueryType::Update,
component: sqlite::Component::Inventory,
component: sqlite::Component::Trips,
},
pool,
"UPDATE trips_items