Skip to main content

systemprompt_analytics/repository/funnel/
mod.rs

1//! Conversion-funnel definitions and per-session progress tracking.
2//!
3//! [`FunnelRepository`] manages `funnels` and their ordered `funnel_steps`,
4//! records `funnel_progress` as sessions advance, and computes drop-off
5//! statistics. Mutations live in `mutations`, reads in `finders` and `stats`,
6//! and shared row types in `types`.
7
8mod finders;
9mod mutations;
10mod stats;
11mod types;
12
13use crate::Result;
14use sqlx::PgPool;
15use std::sync::Arc;
16use systemprompt_database::DbPool;
17
18#[derive(Clone, Debug)]
19pub struct FunnelRepository {
20    pool: Arc<PgPool>,
21    write_pool: Arc<PgPool>,
22}
23
24impl FunnelRepository {
25    pub fn new(db: &DbPool) -> Result<Self> {
26        let pool = db.pool_arc()?;
27        let write_pool = db.write_pool_arc()?;
28        Ok(Self { pool, write_pool })
29    }
30}