Skip to main content

selene_core/database/
createable.rs

1use lunar_lib::database::{CompareAndSwapTransaction, CustomTransactionError, DatabaseEntry};
2
3pub trait Createable: Sized + DatabaseEntry {
4    type CreateArgs: Clone;
5    type Err;
6
7    /// Creates a new [`Self`] in the database using [`Self::CreateArgs`]
8    fn tx_create(
9        cas_tx: &mut CompareAndSwapTransaction<Self::EntryDb>,
10        args: Self::CreateArgs,
11    ) -> Result<Self, CustomTransactionError<Self::Err>>;
12}