pub struct PostgresEnergyCampaignRepository {
pub pool: PgPool,
}Fields§
§pool: PgPoolImplementations§
Trait Implementations§
Source§impl EnergyCampaignRepository for PostgresEnergyCampaignRepository
impl EnergyCampaignRepository for PostgresEnergyCampaignRepository
Source§fn create<'life0, 'life1, 'async_trait>(
&'life0 self,
campaign: &'life1 EnergyCampaign,
) -> Pin<Box<dyn Future<Output = Result<EnergyCampaign, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create<'life0, 'life1, 'async_trait>(
&'life0 self,
campaign: &'life1 EnergyCampaign,
) -> Pin<Box<dyn Future<Output = Result<EnergyCampaign, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Create a new energy campaign
Source§fn find_by_id<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<EnergyCampaign>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_by_id<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<EnergyCampaign>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Find campaign by ID
Source§fn find_by_organization<'life0, 'async_trait>(
&'life0 self,
organization_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<EnergyCampaign>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_by_organization<'life0, 'async_trait>(
&'life0 self,
organization_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<EnergyCampaign>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Find all campaigns for an organization
Source§fn find_by_building<'life0, 'async_trait>(
&'life0 self,
building_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<EnergyCampaign>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_by_building<'life0, 'async_trait>(
&'life0 self,
building_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<EnergyCampaign>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Find all campaigns for a building
Source§fn update<'life0, 'life1, 'async_trait>(
&'life0 self,
campaign: &'life1 EnergyCampaign,
) -> Pin<Box<dyn Future<Output = Result<EnergyCampaign, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update<'life0, 'life1, 'async_trait>(
&'life0 self,
campaign: &'life1 EnergyCampaign,
) -> Pin<Box<dyn Future<Output = Result<EnergyCampaign, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Update campaign
Source§fn delete<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Delete campaign
Source§fn add_offer<'life0, 'life1, 'async_trait>(
&'life0 self,
campaign_id: Uuid,
offer: &'life1 ProviderOffer,
) -> Pin<Box<dyn Future<Output = Result<ProviderOffer, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn add_offer<'life0, 'life1, 'async_trait>(
&'life0 self,
campaign_id: Uuid,
offer: &'life1 ProviderOffer,
) -> Pin<Box<dyn Future<Output = Result<ProviderOffer, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Add provider offer to campaign
Source§fn get_offers<'life0, 'async_trait>(
&'life0 self,
campaign_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<ProviderOffer>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_offers<'life0, 'async_trait>(
&'life0 self,
campaign_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<ProviderOffer>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get all offers for a campaign
Source§fn update_offer<'life0, 'life1, 'async_trait>(
&'life0 self,
offer: &'life1 ProviderOffer,
) -> Pin<Box<dyn Future<Output = Result<ProviderOffer, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_offer<'life0, 'life1, 'async_trait>(
&'life0 self,
offer: &'life1 ProviderOffer,
) -> Pin<Box<dyn Future<Output = Result<ProviderOffer, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Update provider offer
Source§fn delete_offer<'life0, 'async_trait>(
&'life0 self,
offer_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete_offer<'life0, 'async_trait>(
&'life0 self,
offer_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Delete provider offer
Source§fn find_offer_by_id<'life0, 'async_trait>(
&'life0 self,
offer_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<ProviderOffer>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_offer_by_id<'life0, 'async_trait>(
&'life0 self,
offer_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<ProviderOffer>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get offer by ID
Source§fn update_aggregation<'life0, 'async_trait>(
&'life0 self,
campaign_id: Uuid,
total_kwh_electricity: Option<f64>,
total_kwh_gas: Option<f64>,
avg_kwh_per_unit: Option<f64>,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn update_aggregation<'life0, 'async_trait>(
&'life0 self,
campaign_id: Uuid,
total_kwh_electricity: Option<f64>,
total_kwh_gas: Option<f64>,
avg_kwh_per_unit: Option<f64>,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Update campaign aggregated statistics (total_kwh, participants, etc.)
Auto Trait Implementations§
impl Freeze for PostgresEnergyCampaignRepository
impl !RefUnwindSafe for PostgresEnergyCampaignRepository
impl Send for PostgresEnergyCampaignRepository
impl Sync for PostgresEnergyCampaignRepository
impl Unpin for PostgresEnergyCampaignRepository
impl !UnwindSafe for PostgresEnergyCampaignRepository
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
§impl<T> Chain<T> for T
impl<T> Chain<T> for T
§impl<T> Fake for T
impl<T> Fake for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.