1mod attrs;
4mod codegen;
5mod mapping;
6mod naming;
7mod types;
8mod validation;
9
10use proc_macro::TokenStream;
11use syn::{DeriveInput, parse_macro_input};
12
13#[proc_macro]
15pub fn search_entities(input: TokenStream) -> TokenStream {
16 let input = parse_macro_input!(input as mapping::Declarations);
17 input
18 .expand()
19 .unwrap_or_else(syn::Error::into_compile_error)
20 .into()
21}
22
23#[proc_macro_derive(
24 SearchEntity,
25 attributes(search_entity, search_field, search_ignore, sqlx)
26)]
27pub fn derive_search_entity(input: TokenStream) -> TokenStream {
28 let input = parse_macro_input!(input as DeriveInput);
29 codegen::entity::expand(input)
30 .unwrap_or_else(syn::Error::into_compile_error)
31 .into()
32}
33
34#[proc_macro_derive(
35 SearchProjection,
36 attributes(search_projection, search_field, search_ignore, sqlx)
37)]
38pub fn derive_search_projection(input: TokenStream) -> TokenStream {
39 let input = parse_macro_input!(input as DeriveInput);
40 codegen::projection::expand(input)
41 .unwrap_or_else(syn::Error::into_compile_error)
42 .into()
43}