Skip to main content

Module sql

Module sql 

Source
Expand description

The SQL admin engine - schema introspection, generic row/value codecs, and parameterized mutation, all built on larust_orm::AnyPool. HTTP concerns (routes, forms, HTML) live in crate::dashboard, which is this module’s only caller.

Modules§

codec
Generic row <-> value conversion - the one place this crate reads a database row without knowing its shape ahead of time, and the one place it binds a value back without knowing its type ahead of time. Every other part of the SQL admin dashboard goes through these two functions rather than reimplementing either.
introspect
Schema introspection - sqlx::Any has no portable “list tables”/ “describe table” API of its own (confirmed by reading its source: the only “meta” operations it exposes are database-level create/drop, for sqlx::migrate, nothing table/column-level). Every function here hand-writes the per-backend catalog query - sqlite_master/PRAGMA table_info for SQLite, the standard SQL-92 information_schema views for MySQL/Postgres - and decodes the result through the exact same generic row-reading path (sqlx::Row) everything else in this crate’s sql module uses.
mutate
Builds and runs parameterized INSERT/UPDATE/DELETE against an already-introspected table, plus the deliberately-unrestricted raw-SQL path the dashboard’s own “Run SQL” page uses.