Skip to main content

Entity

Trait Entity 

Source
pub trait Entity: TeaqlEntity + Sized {
Show 15 methods // Required methods fn from_compact_row(row: CompactRow) -> Result<Self, EntityError>; fn into_values(self) -> MutationValues; // Provided methods fn from_compact_row_with_context( row: CompactRow, context: &dyn Any, ) -> Result<Self, EntityError> { ... } fn is_field_loaded(&self, _field: &str) -> bool { ... } fn set_checker_loaded_fields(&mut self, _fields: BTreeSet<String>) { ... } fn dirty_fields(&self) -> Option<BTreeSet<String>> { ... } fn is_marked_as_delete(&self) -> bool { ... } fn is_new(&self) -> bool { ... } fn mark_as_new(&mut self) { ... } fn get_comment(&self) -> Option<String> { ... } fn set_comment(&mut self, _comment: String) { ... } fn audit_as(self, comment: impl Into<String>) -> Audited<Self> { ... } fn original_values(&self) -> Option<EntitySnapshot> { ... } fn on_loaded(&mut self, context: &dyn Any) { ... } fn into_json(self) -> Value { ... }
}

Required Methods§

Provided Methods§

Source

fn from_compact_row_with_context( row: CompactRow, context: &dyn Any, ) -> Result<Self, EntityError>

Source

fn is_field_loaded(&self, _field: &str) -> bool

Whether a model field was loaded in the entity snapshot used for a mutation. Implementations without projection tracking remain fully loaded for backwards compatibility.

Source

fn set_checker_loaded_fields(&mut self, _fields: BTreeSet<String>)

Restore the load boundary while materializing the typed Checker view. This is runtime metadata, not mutation intent.

Source

fn dirty_fields(&self) -> Option<BTreeSet<String>>

Returns the set of field names that have been modified since the entity was loaded. Returns None if dirty tracking is not available (backwards compatible default). This is the Rust equivalent of Java’s entity.getUpdatedProperties().

Source

fn is_marked_as_delete(&self) -> bool

Returns true if this entity has been marked for deletion.

Source

fn is_new(&self) -> bool

Returns true if this entity was explicitly constructed as a new entity.

Source

fn mark_as_new(&mut self)

Mark this entity as a newly created entity, bypassing database existence checks.

Source

fn get_comment(&self) -> Option<String>

Get the annotation comment, if any.

Source

fn set_comment(&mut self, _comment: String)

Set an annotation comment for this entity instance.

Source

fn audit_as(self, comment: impl Into<String>) -> Audited<Self>

Attach an audit comment and return a Commented<Self> wrapper. This is the only way to unlock the .save() method.

Source

fn original_values(&self) -> Option<EntitySnapshot>

Get the original snapshot values when this entity was loaded from the repository, if available.

Source

fn on_loaded(&mut self, context: &dyn Any)

Invoked immediately after the entity is loaded from the repository. Used by implementations to attach runtime contexts or initialize internal states.

Source

fn into_json(self) -> Value

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§