Skip to content

Commit

Permalink
Merge pull request #44 from kanko-travel/refactor-wrapper
Browse files Browse the repository at this point in the history
make model_wrapper macro self contaiined
  • Loading branch information
umran authored Oct 28, 2024
2 parents ed350ef + 52c6853 commit 6954fda
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions model/tests/pgoutput.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ use uuid::Uuid;

mod models {
use chrono::{DateTime, NaiveDate, Utc};
use model::{model_wrapper, Model};
use rust_decimal::Decimal;
use serde::{Deserialize, Serialize};
use uuid::Uuid;

#[derive(Serialize, Deserialize, Debug, Clone, Model)]
#[derive(Serialize, Deserialize, Debug, Clone, model::Model)]
#[model(table_name = "test")]
pub struct Test {
#[model(id, primary_key)]
Expand All @@ -18,7 +17,7 @@ mod models {
balance: Decimal,
}

model_wrapper!(Test);
model::model_wrapper!(Test);
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion model_wrapper/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub fn model_wrapper(input: TokenStream) -> TokenStream {

impl ModelWrapper {
pub fn from_pgoutput(table_name: &str, col_names: &Vec<String>, row: Vec<Option<String>>) -> Result<Self, model::Error> {
use model::FromPgoutput;
use model::{ Model, FromPgoutput };

#(#table_name_matches)*
Err(model::Error::bad_request(&format!("unknown tablename {}", table_name)))
Expand Down

0 comments on commit 6954fda

Please sign in to comment.