pub trait LinkService: Send + Sync {
// Required methods
fn create<'life0, 'async_trait>(
&'life0 self,
link: LinkEntity,
) -> Pin<Box<dyn Future<Output = Result<LinkEntity>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<LinkEntity>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<LinkEntity>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn find_by_source<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
source_id: &'life1 Uuid,
link_type: Option<&'life2 str>,
target_type: Option<&'life3 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<LinkEntity>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn find_by_target<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
target_id: &'life1 Uuid,
link_type: Option<&'life2 str>,
source_type: Option<&'life3 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<LinkEntity>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn update<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 Uuid,
link: LinkEntity,
) -> Pin<Box<dyn Future<Output = Result<LinkEntity>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 Uuid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn delete_by_entity<'life0, 'life1, 'async_trait>(
&'life0 self,
entity_id: &'life1 Uuid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Service trait for managing links between entities
This service is completely agnostic to entity types - it only manages relationships using UUIDs and string identifiers.
Required Methods§
Sourcefn create<'life0, 'async_trait>(
&'life0 self,
link: LinkEntity,
) -> Pin<Box<dyn Future<Output = Result<LinkEntity>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn create<'life0, 'async_trait>(
&'life0 self,
link: LinkEntity,
) -> Pin<Box<dyn Future<Output = Result<LinkEntity>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Create a new link between two entities
Sourcefn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<LinkEntity>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<LinkEntity>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get a specific link by ID
Sourcefn list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<LinkEntity>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<LinkEntity>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List all links
Sourcefn find_by_source<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
source_id: &'life1 Uuid,
link_type: Option<&'life2 str>,
target_type: Option<&'life3 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<LinkEntity>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn find_by_source<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
source_id: &'life1 Uuid,
link_type: Option<&'life2 str>,
target_type: Option<&'life3 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<LinkEntity>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Find links by source entity
Optionally filter by link_type and/or target_type
Sourcefn find_by_target<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
target_id: &'life1 Uuid,
link_type: Option<&'life2 str>,
source_type: Option<&'life3 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<LinkEntity>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn find_by_target<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
target_id: &'life1 Uuid,
link_type: Option<&'life2 str>,
source_type: Option<&'life3 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<LinkEntity>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Find links by target entity
Optionally filter by link_type and/or source_type
Sourcefn update<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 Uuid,
link: LinkEntity,
) -> Pin<Box<dyn Future<Output = Result<LinkEntity>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 Uuid,
link: LinkEntity,
) -> Pin<Box<dyn Future<Output = Result<LinkEntity>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Update a link’s metadata
This allows updating the metadata associated with a link without recreating it. Useful for adding/modifying contextual information like status, dates, permissions, etc.
Sourcefn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 Uuid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 Uuid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete a link
Sourcefn delete_by_entity<'life0, 'life1, 'async_trait>(
&'life0 self,
entity_id: &'life1 Uuid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_by_entity<'life0, 'life1, 'async_trait>(
&'life0 self,
entity_id: &'life1 Uuid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete all links involving a specific entity
Used when deleting an entity to maintain referential integrity