objectiveai-cli 2.1.1

ObjectiveAI command-line interface and embeddable library
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Newtype wrapper around `sqlx::PgPool` so the CLI's
//! [`crate::context::Context`] holds a domain-typed handle.
//!
//! Construction is private to this crate via [`super::init::init`]; the
//! pool itself is concurrency-safe so callers can hold `&Pool`
//! everywhere a sqlite `Arc<Mutex<Connection>>` used to be threaded.

use sqlx::PgPool;

#[derive(Debug, Clone)]
pub struct Pool(pub(crate) PgPool);

impl std::ops::Deref for Pool {
    type Target = PgPool;
    fn deref(&self) -> &PgPool {
        &self.0
    }
}