Skip to main content

SubscriptionRepository

Trait SubscriptionRepository 

Source
pub trait SubscriptionRepository: Send + Sync {
    // Required methods
    fn create<'life0, 'life1, 'async_trait>(
        &'life0 self,
        subscription: &'life1 CreateSubscription,
    ) -> Pin<Box<dyn Future<Output = Result<SubscriptionWithBranch, RepositoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_by_id<'life0, 'async_trait>(
        &'life0 self,
        id: i64,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Subscription>, RepositoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_by_id_with_branch<'life0, 'async_trait>(
        &'life0 self,
        id: i64,
    ) -> Pin<Box<dyn Future<Output = Result<Option<SubscriptionWithBranch>, RepositoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_by_keys_with_branch<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        branch_id: i64,
        target_repo: &'life1 TargetRepo,
        event_type: &'life2 EventType,
    ) -> Pin<Box<dyn Future<Output = Result<Option<SubscriptionWithBranch>, RepositoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn list_paginated<'life0, 'async_trait>(
        &'life0 self,
        last_id: i64,
        limit: i64,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Subscription>, RepositoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn list_paginated_with_branches<'life0, 'async_trait>(
        &'life0 self,
        last_id: i64,
        limit: i64,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<SubscriptionWithBranch>, RepositoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn count_remaining<'life0, 'async_trait>(
        &'life0 self,
        last_id: i64,
    ) -> Pin<Box<dyn Future<Output = Result<i64, RepositoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn update<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: i64,
        subscription: &'life1 UpdateSubscription,
    ) -> Pin<Box<dyn Future<Output = Result<Subscription, RepositoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete<'life0, 'async_trait>(
        &'life0 self,
        id: i64,
    ) -> Pin<Box<dyn Future<Output = Result<(), RepositoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_branch_id_by_subscription_id<'life0, 'async_trait>(
        &'life0 self,
        id: i64,
    ) -> Pin<Box<dyn Future<Output = Result<Option<i64>, RepositoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn count_subscriptions_by_branch_id<'life0, 'async_trait>(
        &'life0 self,
        branch_id: i64,
    ) -> Pin<Box<dyn Future<Output = Result<i64, RepositoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn delete_subscription_and_cascade<'life0, 'async_trait>(
        &'life0 self,
        id: i64,
    ) -> Pin<Box<dyn Future<Output = Result<(), RepositoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Interface for subscriptions table operations.

Required Methods§

Source

fn create<'life0, 'life1, 'async_trait>( &'life0 self, subscription: &'life1 CreateSubscription, ) -> Pin<Box<dyn Future<Output = Result<SubscriptionWithBranch, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Creates a new subscription and returns it.

Source

fn get_by_id<'life0, 'async_trait>( &'life0 self, id: i64, ) -> Pin<Box<dyn Future<Output = Result<Option<Subscription>, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the subscription with the given id.

Source

fn get_by_id_with_branch<'life0, 'async_trait>( &'life0 self, id: i64, ) -> Pin<Box<dyn Future<Output = Result<Option<SubscriptionWithBranch>, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the subscription with the given id with its branch information.

Source

fn get_by_keys_with_branch<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, branch_id: i64, target_repo: &'life1 TargetRepo, event_type: &'life2 EventType, ) -> Pin<Box<dyn Future<Output = Result<Option<SubscriptionWithBranch>, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Returns the subscription with the given keys with its branch information.

Source

fn list_paginated<'life0, 'async_trait>( &'life0 self, last_id: i64, limit: i64, ) -> Pin<Box<dyn Future<Output = Result<Vec<Subscription>, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Lists some subscriptions.

last_id is the last subscription ID that is going to be excluded, while limit is the number of subscriptions to show.

Source

fn list_paginated_with_branches<'life0, 'async_trait>( &'life0 self, last_id: i64, limit: i64, ) -> Pin<Box<dyn Future<Output = Result<Vec<SubscriptionWithBranch>, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Lists some subscriptions with their branch information.

Source

fn count_remaining<'life0, 'async_trait>( &'life0 self, last_id: i64, ) -> Pin<Box<dyn Future<Output = Result<i64, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Counts the remaining subscriptions after last_id.

Source

fn update<'life0, 'life1, 'async_trait>( &'life0 self, id: i64, subscription: &'life1 UpdateSubscription, ) -> Pin<Box<dyn Future<Output = Result<Subscription, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Updates the subscription with the given id.

Source

fn delete<'life0, 'async_trait>( &'life0 self, id: i64, ) -> Pin<Box<dyn Future<Output = Result<(), RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Deletes the subscription with the given id.

Source

fn get_branch_id_by_subscription_id<'life0, 'async_trait>( &'life0 self, id: i64, ) -> Pin<Box<dyn Future<Output = Result<Option<i64>, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the branch ID associated to the given subscription’s id.

Source

fn count_subscriptions_by_branch_id<'life0, 'async_trait>( &'life0 self, branch_id: i64, ) -> Pin<Box<dyn Future<Output = Result<i64, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Counts the number of subscriptions associated to the given branch_id.

Source

fn delete_subscription_and_cascade<'life0, 'async_trait>( &'life0 self, id: i64, ) -> Pin<Box<dyn Future<Output = Result<(), RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Deletes a subscription and cascades deletion to the associated branch if no other subscriptions exist.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§