Skip to main content

Crate vizgres

Crate vizgres 

Source
Expand description

vizgres - A fast, keyboard-driven PostgreSQL client for the terminal

vizgres provides a terminal-based interface for working with PostgreSQL databases, designed for daily use by developers who prefer keyboard navigation over mouse-based GUIs.

§Features

  • Schema Browser: Navigate databases, schemas, tables, and columns
  • Query Editor: Write and execute SQL queries with multi-line support
  • Results Viewer: Browse query results with cell-level navigation
  • Inspector: View full cell contents with JSON pretty-printing
  • Keyboard-First: All operations accessible via keyboard shortcuts

§Architecture

The library is organized into several modules:

  • config: Connection profiles and application settings
  • db: Database connectivity and schema introspection
  • ui: Terminal user interface components
  • commands: Command parsing for the command bar
  • error: Error types and result aliases
  • app: Application state and event handling

§Example

use vizgres::config::ConnectionConfig;
use vizgres::db::Database;
use vizgres::db::postgres::PostgresProvider;

// Parse connection URL
let config = ConnectionConfig::from_url("postgres://user:pass@localhost/mydb")?;

// Connect to database (0 = no server-side statement timeout)
let (provider, _conn_err_rx) = PostgresProvider::connect(&config, 0).await?;

// Execute a query (0 = no client timeout, 0 = no row limit)
let results = provider.execute_query("SELECT * FROM users", 0, 0).await?;
println!("Got {} rows", results.row_count);

// Load schema (0 = no limit / load all)
let schema = provider.get_schema(0).await?;
for s in &schema.schemas {
    println!("Schema: {} ({} tables)", s.name, s.tables.len());
}

Re-exports§

pub use error::CommandError;
pub use error::ConfigError;
pub use error::DbError;
pub use error::Result;
pub use error::VizgresError;

Modules§

app
Application state and event handling
commands
Command parsing and execution
completer
Inline ghost-text auto-complete engine
config
Configuration management
connection_manager
Per-tab database connection management.
db
Database layer
error
Error types for vizgres
export
Query results export (CSV / JSON)
history
Query history with shell-like navigation
keymap
Data-driven keybinding configuration
ui
Terminal UI components