Crate axum_sql_viewer

Crate axum_sql_viewer 

Source
Expand description

§axum-sql-viewer

A development tool for viewing SQL tables in web browsers, easily integrable as an Axum layer.

§Features

  • Dynamic schema discovery for any SQL database
  • Web-based table browser with infinite scrolling
  • Column sorting and filtering
  • Raw SQL query execution
  • Support for SQLite and PostgreSQL

§Security Warning

This is a development tool only!

  • No authentication/authorization built-in
  • Exposes full database schema and data
  • Raw query execution allows full database access (INSERT/UPDATE/DELETE)
  • Should never be exposed in production or public networks

§Example Usage

use axum::{Router, routing::get};
use axum_sql_viewer::SqlViewerLayer;
use sqlx::SqlitePool;

#[tokio::main]
async fn main() {
    let pool = SqlitePool::connect("sqlite::memory:")
        .await
        .unwrap();

    let app = Router::new()
        .route("/", get(|| async { "Hello, World!" }))
        .merge(SqlViewerLayer::sqlite("/sql-viewer", pool).into_router());

    // Serve the application...
}

Re-exports§

pub use layer::SqlViewerLayer;
pub use schema::ColumnInfo;
pub use schema::ForeignKey;
pub use schema::IndexInfo;
pub use schema::TableSchema;
pub use database::traits::DatabaseProvider;
pub use database::sqlite::SqliteProvider;
pub use database::postgres::PostgresProvider;

Modules§

api
REST API endpoints
database
Database abstraction layer
frontend
Frontend asset serving
layer
SqlViewerLayer - Main Axum integration layer
schema
Schema types for dynamic database introspection

Enums§

Error

Type Aliases§

Result