Data

Trait Data 

Source
pub trait Data: Entity {
    // Required methods
    fn id(&self) -> Uuid;
    fn tenant_id(&self) -> Uuid;
    fn indexed_fields() -> &'static [&'static str];
    fn field_value(&self, field: &str) -> Option<FieldValue>;

    // Provided method
    fn type_name() -> &'static str { ... }
}
Expand description

Trait for data entities that represent concrete domain objects.

Data entities are the primary building blocks of the system. They have:

  • A unique identifier
  • Tenant isolation
  • Searchable fields
  • Type information

Required Methods§

Source

fn id(&self) -> Uuid

Get the unique identifier for this entity instance

Source

fn tenant_id(&self) -> Uuid

Get the tenant ID for multi-tenant isolation

Source

fn indexed_fields() -> &'static [&'static str]

List of fields that should be indexed for searching

Source

fn field_value(&self, field: &str) -> Option<FieldValue>

Get the value of a specific field by name

Returns None if the field doesn’t exist or can’t be converted

Provided Methods§

Source

fn type_name() -> &'static str

Get the type name of this entity (defaults to singular resource name)

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§