Expand description
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.
Structs§
- Column
Info - One column’s shape - enough to render an edit input and bind a
submitted value back to it correctly (see
codec::json_to_any_value). ABlob-kind column is a known, stated v1 gap, not silently mishandled: the browse view renders its value as<blob, N bytes>(never the raw bytes), and a submitted value for one is stored as plain text rather than real binary -dashboard::sql_views’s edit/insert forms don’t yet special-case it with a distinct (disabled, or upload-shaped) input, so editing one through the dashboard silently overwrites it with UTF-8 text. No table indemoor the framework’s own schema has one today.
Functions§
- list_
foreign_ keys table’s foreign keys, one row per referencing column. Same shape/ rendering rationale aslist_indexes.- list_
indexes table’s indexes, one row per index (shape varies by backend - see each arm below). Rendered through the same generic result-table machinery as the raw/sqlpage’s output (codec::row_to_jsonhandles anyAnyRow,PRAGMA/SHOWoutput included), not a bespoke parsed struct - this is a read-only viewer, the raw columns are the point. Same “caller already validatedtable” contract astable_columns.- list_
tables - Every real table in the connected database, alphabetical - delegates to
larust_orm::table_names(), which hand-writes this same per-backend catalog query for its own [larust_orm::migrate::fresh]; kept as one query with two callers rather than duplicated here. - primary_
key_ columns table’s primary key column(s), in key order - composite-safe. Same “caller already validatedtable” contract astable_columns.- table_
columns table’s columns, in declaration order. Callers MUST have already validatedtableagainstlist_tables- SQLite’sPRAGMAcan’t take a bind parameter for the table name, so it’s interpolated directly, safe only because it’s guaranteed to be a real, existing table name by the time this runs, never raw user input.