pub struct EntityRecord {
pub entity_id: EntityId,
pub name: String,
pub company_code: Option<String>,
pub created_date: NaiveDate,
pub valid_from: NaiveDate,
pub valid_to: Option<NaiveDate>,
pub status: EntityStatus,
pub status_changed_date: Option<NaiveDate>,
pub attributes: HashMap<String, String>,
}Expand description
Record of an entity in the registry.
Fields§
§entity_id: EntityIdEntity identifier
name: StringHuman-readable name/description
company_code: Option<String>Company code this entity belongs to (if applicable)
created_date: NaiveDateDate the entity was created
valid_from: NaiveDateDate the entity becomes valid (may differ from created)
valid_to: Option<NaiveDate>Date the entity is valid until (None = indefinite)
status: EntityStatusCurrent status
status_changed_date: Option<NaiveDate>Date status last changed
attributes: HashMap<String, String>Additional attributes as key-value pairs
Implementations§
Source§impl EntityRecord
impl EntityRecord
Sourcepub fn new(
entity_id: EntityId,
name: impl Into<String>,
created_date: NaiveDate,
) -> Self
pub fn new( entity_id: EntityId, name: impl Into<String>, created_date: NaiveDate, ) -> Self
Create a new entity record.
Sourcepub fn with_company_code(self, company_code: impl Into<String>) -> Self
pub fn with_company_code(self, company_code: impl Into<String>) -> Self
Set company code.
Sourcepub fn with_validity(self, from: NaiveDate, to: Option<NaiveDate>) -> Self
pub fn with_validity(self, from: NaiveDate, to: Option<NaiveDate>) -> Self
Set validity period.
Sourcepub fn with_attribute(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_attribute( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Add an attribute.
Sourcepub fn is_valid_on(&self, date: NaiveDate) -> bool
pub fn is_valid_on(&self, date: NaiveDate) -> bool
Check if the entity is valid on a given date.
Sourcepub fn can_transact_on(&self, date: NaiveDate) -> bool
pub fn can_transact_on(&self, date: NaiveDate) -> bool
Check if the entity can be used in transactions on a given date.
Trait Implementations§
Source§impl Clone for EntityRecord
impl Clone for EntityRecord
Source§fn clone(&self) -> EntityRecord
fn clone(&self) -> EntityRecord
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 EntityRecord
impl Debug for EntityRecord
Source§impl<'de> Deserialize<'de> for EntityRecord
impl<'de> Deserialize<'de> for EntityRecord
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 EntityRecord
impl RefUnwindSafe for EntityRecord
impl Send for EntityRecord
impl Sync for EntityRecord
impl Unpin for EntityRecord
impl UnwindSafe for EntityRecord
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