Skip to main content

sqlx_gen_macros/
lib.rs

1use proc_macro::TokenStream;
2
3/// No-op derive macro that registers `sqlx_gen` as a helper attribute.
4///
5/// This allows `#[sqlx_gen(...)]` to be used on both structs and fields
6/// without the compiler rejecting them as unknown attributes.
7///
8/// # Usage
9///
10/// Add `SqlxGen` to your derive list:
11/// ```ignore
12/// #[derive(sqlx::FromRow, SqlxGen)]
13/// #[sqlx_gen(kind = "table", table = "users")]
14/// pub struct Users {
15///     #[sqlx_gen(primary_key)]
16///     pub id: i32,
17/// }
18/// ```
19#[proc_macro_derive(SqlxGen, attributes(sqlx_gen))]
20pub fn derive_sqlx_gen(_input: TokenStream) -> TokenStream {
21    TokenStream::new()
22}