Skip to main content

Module db

Module db 

Source
Expand description

Read-only access to the databases a user has registered.

The read-safe half of the database layer, and the one an agent reaches. It can list connections, read a catalog, and sample rows; it cannot change anything. Everything that can is in nomoreide-actions, behind a per connection unlock and an affected-rows preview a human has to look at.

Two things here are load-bearing rather than cosmetic. A connection URL is masked before it leaves this module, because a registered database’s URL carries its password and the agent asking for the list has no business reading it. And a column whose name suggests a secret is replaced with bullets in a sample, so a peek at a users table does not hand back everyone’s password hash.

Moved out of the Tauri command module; the desktop app now calls in here.

Structs§

CatalogCapabilities
CatalogObject
ColumnInfo
DetectedConnection
One connection string found in a service’s .env.
ExportWriter
Builds an export a chunk at a time.
NamedDefinition
ObjectDetails
ObjectRows
QueryResult
RowBrowseQuery
RowFilter
RowSort
TableRef
A table or view as the tool listing spells it.

Enums§

ExportFormat
The two formats the route offers, matched exactly – CSV is not csv.
QueryOutcome
What query came back with.

Constants§

DEFAULT_ROW_LIMIT
The default row cap. Both sample and query share it.

Functions§

capabilities
Which object kinds and table details this engine can be asked about.
columns_for
connection
The connection a name refers to, or a refusal naming it.
content_disposition
The header that makes a browser save the file rather than show it.
csv_cell
One CSV cell.
detect_from_env
Scan registered services’ .env files for anything that looks like a connection string.
driver_message
What the database itself said, without sqlx’s framing around it.
engine_from_url
Guess an engine from a connection string or a bare file path.
export_filename
What the downloaded file is called.
export_sql
The statement that reads an object for export, ordered so the file is the same file twice.
first_statement
The first statement in a caller’s text, with anything after the first top-level ; dropped.
hex_bytes
is_read_statement
Whether a statement is one this connection would have run.
is_sensitive_connection_parameter
Query-string fields that must never leave the machine in the clear.
is_sensitive_preview_column
list_connections
Every registered connection, with its URL masked.
list_db_tables
lossless_json_integer
mask_url
A connection URL with its password removed.
merge_stored_password
Put the stored password back into an edited connection string.
object_details
Columns, indexes, constraints, triggers, and a capped create script for one object named by the opaque key a listing handed out.
objects_for
peek_connection
The connection a name refers to, refused in the reference’s own words.
peek_details
peek_objects
The objects in one schema, or nothing when the schema is not one of this connection’s. An unknown schema is empty rather than an error: the agent asked what is in a place, and the answer is that nothing is.
peek_query
The same statement, answered the way an agent is answered.
peek_sample
Rows from one named table, with the column schema that explains them.
peek_schemas
peek_tables
Every table and view this connection holds, in one flat list ordered the way a schema listing would be.
public_connection
One connection as every surface reports it: no raw URL, and no key at all for a project path the connection does not have. An absent field and a null one read differently to whatever is on the other end.
quote_identifier
redact_database_error
Take the connection string, and any password inside it, out of an error.
resolve_object
The object an opaque key names, resolved only by equality against a freshly read catalog.
row_browse_clauses
run_capped_query
One caller-written statement, capped and wrapped.
run_query
sample_object
Rows from one object, with the browser’s filters and sort applied and any column that looks like a secret bulleted out.
schemas_for
test_connection
Check that a connection can be reached, without saying anything about it.
write_staging_guidance
What to say instead of running a write.