EntityBase

Trait EntityBase 

Source
pub trait EntityBase: 'static + Sized {
    type ConnectionType: for<'a> DatabaseConnection<'a>;
    type AutoGeneratedFields: Default;

    const COLLECTION_NAME: &'static str;

    // Required method
    fn to_transaction_entity(self) -> Entity;

    // Provided methods
    fn downcast<T: EntityBase>(&self) -> Option<&T> { ... }
    fn downcast_arc<T>(self: Arc<Self>) -> Option<Arc<T>>
       where Self: Send + Sync,
             T: EntityBase + Send + Sync { ... }
}
Expand description

A supertrait that all entities must implement. This handles multiplexing over the two different database backends.

This trait should be removed once the persistence layers are unified. See WPB-16241.

Required Associated Constants§

Source

const COLLECTION_NAME: &'static str

Beware: if you change the value of this constant on any WASM entity, you’ll need to do a data migration not only because it is used as reference to the object store names but also for the value of the aad.

Required Associated Types§

Source

type ConnectionType: for<'a> DatabaseConnection<'a>

Source

type AutoGeneratedFields: Default

Entities which implement EntityDatabaseMutation have a pre_save method which might generate or update some fields of the item. The canonical example is an updated_at field.

This type must contain a copy of each modification to the item, so that the caller of a .save(entity) function can know what has changed and what the new values are.

Required Methods§

Source

fn to_transaction_entity(self) -> Entity

Provided Methods§

Source

fn downcast<T: EntityBase>(&self) -> Option<&T>

Source

fn downcast_arc<T>(self: Arc<Self>) -> Option<Arc<T>>
where Self: Send + Sync, T: EntityBase + Send + Sync,

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.

Implementors§

Source§

impl EntityBase for ConsumerData

Source§

impl EntityBase for E2eiAcmeCA

Source§

impl EntityBase for E2eiCrl

Source§

impl EntityBase for E2eiIntermediateCert

Source§

impl EntityBase for MlsPendingMessage

Source§

impl EntityBase for PersistedMlsGroup

Source§

impl EntityBase for PersistedMlsPendingGroup

Source§

impl EntityBase for ProteusIdentity

Source§

impl EntityBase for ProteusPrekey

Source§

impl EntityBase for ProteusSession

Source§

impl EntityBase for StoredBufferedCommit

Source§

impl EntityBase for StoredCredential

Source§

impl EntityBase for StoredE2eiEnrollment

Source§

impl EntityBase for StoredEncryptionKeyPair

Source§

impl EntityBase for StoredEpochEncryptionKeypair

Source§

const COLLECTION_NAME: &'static str = "mls_epoch_encryption_keypairs"

Source§

type ConnectionType = SqlCipherConnection

Source§

type AutoGeneratedFields = ()

Source§

impl EntityBase for StoredHpkePrivateKey

Source§

impl EntityBase for StoredKeypackage

Source§

impl EntityBase for StoredPskBundle