refactor(id_type): use macros for defining ID types and implementing common traits (#5471)

This commit is contained in:
Sanchith Hegde
2024-07-30 20:21:29 +05:30
committed by GitHub
parent be9347b8d5
commit 1d4fb1d247
34 changed files with 321 additions and 384 deletions

View File

@ -217,12 +217,12 @@ fn generate_ref_id_with_default_length<const MAX_LENGTH: u8, const MIN_LENGTH: u
/// Generate a customer id with default length, with prefix as `cus`
pub fn generate_customer_id_of_default_length() -> id_type::CustomerId {
id_type::CustomerId::new(generate_ref_id_with_default_length("cus"))
id_type::CustomerId::default()
}
/// Generate a organization id with default length, with prefix as `org`
pub fn generate_organization_id_of_default_length() -> id_type::OrganizationId {
id_type::OrganizationId::new(generate_ref_id_with_default_length("org"))
id_type::OrganizationId::default()
}
/// Generate a nanoid with the given prefix and a default length