pub trait IdGenerator<Id: IdType, DbId: PostgresIdType>: Send + Sync {
// Required methods
fn create_statement_column_type(&self) -> &str;
fn generate_id(&self) -> Option<DbId>;
fn id_to_db_id<'a>(
&self,
id: Cow<'a, Id>,
) -> Result<Cow<'a, DbId>, C3p0Error>;
fn db_id_to_id<'a>(
&self,
id: Cow<'a, DbId>,
) -> Result<Cow<'a, Id>, C3p0Error>;
}
Expand description
A trait that allows the creation of an Id
Required Methods§
Sourcefn create_statement_column_type(&self) -> &str
fn create_statement_column_type(&self) -> &str
Returns the column type for the id in the create statement
Sourcefn generate_id(&self) -> Option<DbId>
fn generate_id(&self) -> Option<DbId>
Generates a new id