Skip to main content

Entity

Trait Entity 

Source
pub trait Entity: TeaqlEntity + Sized {
Show 25 methods // Required methods fn from_compact_row(row: CompactRow) -> Result<Self, EntityError>; fn into_values(self) -> MutationValues; // Provided methods fn dynamic_property_type(&self, key: &str) -> Option<DataType> { ... } fn dynamic_property(&self, _key: &str) -> Option<&Value> { ... } fn has_dynamic_property(&self, _key: &str) -> bool { ... } fn dynamic_field_values(&self) -> Option<&DynamicFieldValues> { ... } fn has_pending_dynamic_mutations(&self) -> bool { ... } fn update_dynamic_field( &mut self, code: &str, _value: Value, ) -> Result<(), DynamicFieldError> { ... } fn delete_dynamic_field( &mut self, code: &str, ) -> Result<(), DynamicFieldError> { ... } fn supports_dynamic_field_load() -> bool { ... } fn loaded_state_snapshot(&self) -> Option<Arc<LoadedSnapshot>> { ... } 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 set_checker_dirty_fields( &mut self, _fields: BTreeSet<String>, _values: &MutationValues, ) { ... } 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 dynamic_property_type(&self, key: &str) -> Option<DataType>

Optional readonly schema: a known type does not make a missing property present.

Source

fn dynamic_property(&self, _key: &str) -> Option<&Value>

Borrow a readonly derived property using its full _-prefixed name. Missing properties and explicit null both return None; real zero, false and empty text remain values. This never loads data or changes state.

Source

fn has_dynamic_property(&self, _key: &str) -> bool

Presence is separate from the nullable derived-property read contract. An explicit null is present; an absent key is not. Native fields and persistent # extensions are not part of this namespace.

Source

fn dynamic_field_values(&self) -> Option<&DynamicFieldValues>

Runtime-owned persistent-extension carrier, separate from readonly dynamic properties.

Source

fn has_pending_dynamic_mutations(&self) -> bool

Source

fn update_dynamic_field( &mut self, code: &str, _value: Value, ) -> Result<(), DynamicFieldError>

Source

fn delete_dynamic_field(&mut self, code: &str) -> Result<(), DynamicFieldError>

Source

fn supports_dynamic_field_load() -> bool

Source

fn loaded_state_snapshot(&self) -> Option<Arc<LoadedSnapshot>>

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 set_checker_dirty_fields( &mut self, _fields: BTreeSet<String>, _values: &MutationValues, )

Restore the caller’s exact mutation boundary while materializing the typed Checker view. This metadata is used only during validation and must not widen the eventual database update.

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§