rok_repl/lib.rs
1/// Interactive REPL (tinker) engine for rok applications.
2///
3/// Connects to the application database via `DATABASE_URL` and provides
4/// an interactive prompt for inspecting data and running SQL.
5///
6/// # Example
7///
8/// ```rust,ignore
9/// rok_repl::run().await?;
10/// ```
11#[cfg(feature = "postgres")]
12mod session;
13
14/// Start the interactive tinker REPL.
15///
16/// Reads `DATABASE_URL` from the environment (or `.env`), connects to
17/// PostgreSQL, and opens the readline prompt.
18///
19/// # Errors
20///
21/// Returns an error if `DATABASE_URL` is unset or the connection fails.
22#[cfg(feature = "postgres")]
23pub async fn run() -> anyhow::Result<()> {
24 session::TinkerSession::new().await?.run().await
25}