use rullst_orm_macros::Orm;
use syn::{parse_quote, DeriveInput};
#[test]
fn test_basic_model() {
let input: DeriveInput = parse_quote! {
#[derive(Orm)]
#[orm(table = "users")]
pub struct User {
pub id: i32,
pub name: String,
pub email: String,
}
};
let _ = input;
}
#[test]
fn test_model_with_relations() {
let input: DeriveInput = parse_quote! {
#[derive(Orm)]
pub struct Post {
pub id: i32,
pub title: String,
#[orm(has_many = "Comment")]
comments: Option<Vec<Comment>>,
}
};
let _ = input;
}
#[test]
fn test_model_with_soft_deletes() {
let input: DeriveInput = parse_quote! {
#[derive(Orm)]
pub struct User {
pub id: i32,
pub name: String,
pub deleted_at: Option<String>,
}
};
let _ = input;
}
#[test]
fn test_model_with_hidden_fields() {
let input: DeriveInput = parse_quote! {
#[derive(Orm)]
pub struct User {
pub id: i32,
pub name: String,
#[orm(hidden)]
pub password: String,
}
};
let _ = input;
}