pub struct ObjectRelationship {
pub relationship_id: Uuid,
pub relationship_type: String,
pub source_object_id: Uuid,
pub source_type_id: String,
pub target_object_id: Uuid,
pub target_type_id: String,
pub established_at: DateTime<Utc>,
pub quantity: Option<Decimal>,
pub attributes: HashMap<String, ObjectAttributeValue>,
}Expand description
Many-to-many relationship between object instances.
Fields§
§relationship_id: UuidUnique relationship ID
relationship_type: StringRelationship type (from ObjectRelationshipType)
source_object_id: UuidSource object ID
source_type_id: StringSource object type
target_object_id: UuidTarget object ID
target_type_id: StringTarget object type
established_at: DateTime<Utc>When the relationship was established
quantity: Option<Decimal>Optional quantity for the relationship (e.g., items ordered)
attributes: HashMap<String, ObjectAttributeValue>Additional attributes
Implementations§
Source§impl ObjectRelationship
impl ObjectRelationship
Sourcepub fn new(
relationship_type: &str,
source_object_id: Uuid,
source_type_id: &str,
target_object_id: Uuid,
target_type_id: &str,
) -> Self
pub fn new( relationship_type: &str, source_object_id: Uuid, source_type_id: &str, target_object_id: Uuid, target_type_id: &str, ) -> Self
Create a new object relationship.
Sourcepub fn with_timestamp(self, timestamp: DateTime<Utc>) -> Self
pub fn with_timestamp(self, timestamp: DateTime<Utc>) -> Self
Set the established timestamp.
Sourcepub fn with_quantity(self, quantity: Decimal) -> Self
pub fn with_quantity(self, quantity: Decimal) -> Self
Set the quantity.
Sourcepub fn with_attribute(self, key: &str, value: ObjectAttributeValue) -> Self
pub fn with_attribute(self, key: &str, value: ObjectAttributeValue) -> Self
Add an attribute.
Trait Implementations§
Source§impl Clone for ObjectRelationship
impl Clone for ObjectRelationship
Source§fn clone(&self) -> ObjectRelationship
fn clone(&self) -> ObjectRelationship
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ObjectRelationship
impl Debug for ObjectRelationship
Source§impl<'de> Deserialize<'de> for ObjectRelationship
impl<'de> Deserialize<'de> for ObjectRelationship
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ObjectRelationship
impl RefUnwindSafe for ObjectRelationship
impl Send for ObjectRelationship
impl Sync for ObjectRelationship
impl Unpin for ObjectRelationship
impl UnwindSafe for ObjectRelationship
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more