gaman_macros/lib.rs
1mod attrs;
2mod codegen;
3mod column;
4mod embedded;
5mod table;
6
7use proc_macro::TokenStream;
8
9/// Embed `.yaml` migrations from a directory at compile time.
10/// Returns an `EmbeddedMigrations` value carrying both the compiled-in files and the absolute
11/// source directory path, so the runtime can validate against `config.migrations_dir`.
12#[proc_macro]
13pub fn embedded_migrations(input: TokenStream) -> TokenStream {
14 embedded::embedded_migrations(input)
15}
16
17/// Derive `IntoTable` for a named struct.
18/// Supports `#[table(name = "...", schema = "...")]` plus column attributes for
19/// naming, explicit SQL types, nullability, defaults, keys, indexes, and checks.
20#[proc_macro_derive(IntoTable, attributes(table, column))]
21pub fn derive_into_table(input: TokenStream) -> TokenStream {
22 codegen::derive_into_table(input)
23}