pub trait PrefixedId {
const PREFIX: &'static str;
// Provided methods
fn new_id() -> String { ... }
fn id_prefix() -> String { ... }
}
Expand description
ยงSea-orm Newtype ID is a ID generation system ๐
- ๐ฒ Currently uses
nanoid
- ๐ฆ Stripe style IDs allow for users to see what kind of IDs are being used without having to log them in the database
ยงRationale
String
ly typed IDs can be very error prone, think of the case where you are using more than one ID at a time PrefixId
Is a trait that is used to add prefix based ID generation to a given domain object, e.g. an object that gets inserted into the database
Required Associated Constantsยง
Provided Methodsยง
Dyn Compatibilityยง
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.