Trait EntityBase

Source
pub trait EntityBase<S: ContextTrait>:
    for<'de> Deserialize<'de>
    + Serialize
    + Send
    + Sync
    + Unpin
    + 'static {
    type Id: for<'de> Deserialize<'de> + Clone + Display + Serialize + Send;
    type Create: for<'de> Deserialize<'de> + Serialize + Send + Sync + Unpin + 'static;
    type Update: for<'de> Deserialize<'de> + Serialize + Send + Sync + Unpin + 'static;
    type NumberOfColumns: ArrayLength;

    // Required methods
    fn name() -> &'static str;
    fn name_plural() -> &'static str;
    fn id(&self) -> &Self::Id;
    fn columns() -> GenericArray<ColumnInfo, Self::NumberOfColumns>;
    fn column_values(&self) -> GenericArray<&dyn Column, Self::NumberOfColumns>;
    fn inputs(
        value: Option<&Self>,
    ) -> impl IntoIterator<Item = InputInfo<'_, S>>;
}

Required Associated Types§

Source

type Id: for<'de> Deserialize<'de> + Clone + Display + Serialize + Send

should usually be an UUID

Source

type Create: for<'de> Deserialize<'de> + Serialize + Send + Sync + Unpin + 'static

Source

type Update: for<'de> Deserialize<'de> + Serialize + Send + Sync + Unpin + 'static

Source

type NumberOfColumns: ArrayLength

Required Methods§

Source

fn name() -> &'static str

Source

fn name_plural() -> &'static str

Source

fn id(&self) -> &Self::Id

should return the value of the field used as primary key.

Source

fn columns() -> GenericArray<ColumnInfo, Self::NumberOfColumns>

Source

fn column_values(&self) -> GenericArray<&dyn Column, Self::NumberOfColumns>

Source

fn inputs(value: Option<&Self>) -> impl IntoIterator<Item = InputInfo<'_, S>>

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§