symbols_models/
lib.rs

1#![deny(warnings)]
2#![deny(missing_docs)]
3
4//! # Symbols-models
5//!
6//! Shared traits from Symbols proc-macro-utility, to be able to share models between macros and real applications.
7
8use sea_orm::{
9    sea_query::{Expr, SimpleExpr},
10    EntityTrait,
11};
12
13/// This trait allows data filtering on macro execution  
14/// It's default implementation simply adds WHERE 1 = 1 to data retrieve query
15///
16/// Since only basic types are supported, it's important to use only basic types in models.
17pub trait EntityFilter: EntityTrait + Default {
18    /// Returned expression in injected in data retrieve query to allow data filtering
19    fn filter() -> SimpleExpr {
20        Expr::val(1).eq(1)
21    }
22}