Skip to main content

CompetitionWriter

Trait CompetitionWriter 

Source
pub trait CompetitionWriter: CompetitionReader {
    // Required methods
    fn create_competition<'life0, 'life1, 'async_trait>(
        &'life0 self,
        input: &'life1 CompetitionUpsertInput,
    ) -> Pin<Box<dyn Future<Output = Result<CompetitionRecord, CompetitionWriteError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn update_competition<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'async_trait>(
        &'life0 self,
        competition_id: i64,
        name: &'life1 str,
        description: Option<&'life2 str>,
        rules_url: Option<&'life3 str>,
        rules_content: Option<&'life4 str>,
        win_conditions: &'life5 [String],
        primary_win_condition: &'life6 str,
        start_ts_ms: i64,
        end_ts_ms: i64,
    ) -> Pin<Box<dyn Future<Output = Result<CompetitionRecord, CompetitionWriteError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait,
             'life5: 'async_trait,
             'life6: 'async_trait;
    fn delete_competition<'life0, 'async_trait>(
        &'life0 self,
        competition_id: i64,
    ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn record_competition_fill<'life0, 'life1, 'async_trait>(
        &'life0 self,
        input: &'life1 CompetitionFillInput,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn finalize_competition<'life0, 'life1, 'async_trait>(
        &'life0 self,
        competition_id: i64,
        stats: &'life1 [CompetitionFinalStatsInput],
    ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn set_profile_image_url<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        wallet: &'life1 WalletAddress,
        profile_image_url: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Write operations for competitions and related entities.

Required Methods§

Source

fn create_competition<'life0, 'life1, 'async_trait>( &'life0 self, input: &'life1 CompetitionUpsertInput, ) -> Pin<Box<dyn Future<Output = Result<CompetitionRecord, CompetitionWriteError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create a new competition. Returns OverlapViolation if the window conflicts.

Source

fn update_competition<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'async_trait>( &'life0 self, competition_id: i64, name: &'life1 str, description: Option<&'life2 str>, rules_url: Option<&'life3 str>, rules_content: Option<&'life4 str>, win_conditions: &'life5 [String], primary_win_condition: &'life6 str, start_ts_ms: i64, end_ts_ms: i64, ) -> Pin<Box<dyn Future<Output = Result<CompetitionRecord, CompetitionWriteError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait, 'life6: 'async_trait,

Update an existing competition by ID. All fields are pre-resolved by caller. Returns OverlapViolation if the new window conflicts.

Source

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

Delete a competition by ID. Returns number of rows deleted.

Source

fn record_competition_fill<'life0, 'life1, 'async_trait>( &'life0 self, input: &'life1 CompetitionFillInput, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Record a competition fill event (idempotent via ON CONFLICT DO NOTHING).

Source

fn finalize_competition<'life0, 'life1, 'async_trait>( &'life0 self, competition_id: i64, stats: &'life1 [CompetitionFinalStatsInput], ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Finalize a competition: insert final stats rows in a transaction. Uses pg_advisory_xact_lock to prevent double-finalization. Returns the number of rows inserted.

Source

fn set_profile_image_url<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, wallet: &'life1 WalletAddress, profile_image_url: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Set profile image URL for a wallet. Returns the previous URL (if any).

Implementors§