Skip to main content

Module saved_queries

Module saved_queries 

Source
Expand description

Named read-only SQL queries exposed via the save_query / delete_query tools and the hyper://queries/{name}/definition + hyper://queries/{name}/result resources.

Two SavedQueryStore implementations:

  • SessionStore — in-memory HashMap behind a Mutex. Used for ephemeral servers (no --workspace) where persistence across restarts is meaningless because the whole .hyper file is thrown away.
  • WorkspaceStore — backs onto a dedicated meta-table _hyperdb_saved_queries inside the Hyper workspace. Chosen when a --workspace path is configured so saved queries survive restarts alongside the data they query.

The server picks a store variant in HyperMcpServer::new and hands it to tool handlers through Arc<dyn SavedQueryStore>. Both variants share the same async-free API so call sites don’t have to care which is in use.

Structs§

SavedQuery
A named SQL query stored in the workspace.
SessionStore
In-memory SavedQueryStore for ephemeral workspaces. Entries live in a Mutex<HashMap> and vanish when the server process exits.
WorkspaceStore
Persistent SavedQueryStore backed by the _hyperdb_saved_queries meta-table inside the .hyper workspace. Rows round-trip through SQL parameter binding so saved queries containing quotes or backslashes are handled safely.

Constants§

SAVED_QUERIES_TABLE
The meta-table used by WorkspaceStore to persist named queries inside the .hyper workspace. The underscore prefix is a convention for “HyperDB internal” — users shouldn’t query or mutate it directly.

Traits§

SavedQueryStore
CRUD interface shared by both storage backends.

Functions§

build_store
Build the right store for a given workspace mode.