selene_core/database/createable.rs
1use crate::database::{DatabaseEntry, DatabaseError, transaction_args::CompareAndSwapTransaction};
2
3pub trait Createable: Sized + DatabaseEntry {
4 type CreateArgs;
5
6 /// Creates a new [`Self`] in the database using [`Self::CreateArgs`]
7 fn tx_create(
8 cas_tx: &mut CompareAndSwapTransaction,
9 args: Self::CreateArgs,
10 ) -> Result<Self::Id, DatabaseError>;
11}