development_postgress #11

Merged
lee merged 11 commits from development_postgress into main 2025-07-31 13:32:49 +00:00
3 changed files with 15 additions and 0 deletions
Showing only changes of commit 0a8c5d1c1f - Show all commits

View File

@ -169,6 +169,10 @@ pub fn model(_attr: TokenStream, item: TokenStream) -> TokenStream {
fn key() -> &'static str { fn key() -> &'static str {
#index_key #index_key
} }
fn field_name() -> &'static str {
#name_str
}
} }
}; };

View File

@ -84,6 +84,9 @@ impl Index for CompanyNameIndex {
fn key() -> &'static str { fn key() -> &'static str {
"name" "name"
} }
fn field_name() -> &'static str {
"name"
}
} }
pub struct CompanyRegistrationNumberIndex; pub struct CompanyRegistrationNumberIndex;
@ -93,6 +96,9 @@ impl Index for CompanyRegistrationNumberIndex {
fn key() -> &'static str { fn key() -> &'static str {
"registration_number" "registration_number"
} }
fn field_name() -> &'static str {
"registration_number"
}
} }
// --- Builder Pattern --- // --- Builder Pattern ---

View File

@ -83,6 +83,11 @@ pub trait Index {
/// The key of this index /// The key of this index
fn key() -> &'static str; fn key() -> &'static str;
/// The original field name. This is the same as [Index::key] by default, unless the user
/// specified a `(name=...)` value to the index attribute, in which case [Index::key] will be
/// set to the specified key.
fn field_name() -> &'static str;
} }
/// Base struct that all models should include /// Base struct that all models should include