From edf9162c21e435421a41b480545f39d20028bbb0 Mon Sep 17 00:00:00 2001 From: Virgil Date: Sat, 4 Apr 2026 11:19:22 +0000 Subject: [PATCH] docs(store): clarify workspace query support Co-Authored-By: Virgil --- docs/architecture.md | 2 +- docs/index.md | 2 +- workspace.go | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/architecture.md b/docs/architecture.md index 92c7d4c..183c419 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -256,7 +256,7 @@ transaction.go Store.Transaction and transaction-scoped mutation helpers events.go EventType, Event, Watch, Unwatch, OnChange, notify scope.go ScopedStore, QuotaConfig, namespace-local helper delegation, quota enforcement journal.go Journal persistence, Flux-like querying, JSON row inflation -workspace.go Workspace buffers, aggregation, commit flow, orphan recovery +workspace.go Workspace buffers, aggregation, query analysis, commit flow, orphan recovery compact.go Cold archive generation to JSONL gzip or zstd store_test.go Tests: CRUD, TTL, concurrency, edge cases, persistence events_test.go Tests: Watch, Unwatch, OnChange, event dispatch diff --git a/docs/index.md b/docs/index.md index 94d738c..a552e7f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -122,7 +122,7 @@ The entire package lives in a single Go package (`package store`) with the follo | `events.go` | `EventType` constants, `Event` struct, `Watch`/`Unwatch` channel subscriptions, `OnChange` callback registration, internal `notify` dispatch | | `scope.go` | `ScopedStore` wrapper for namespace isolation, `QuotaConfig` struct, `NewScoped`/`NewScopedWithQuota` constructors, namespace-local helper delegation, quota enforcement logic | | `journal.go` | Journal persistence, Flux-like querying, JSON row inflation, journal schema helpers | -| `workspace.go` | Workspace buffers, aggregation, commit flow, and orphan recovery | +| `workspace.go` | Workspace buffers, aggregation, query analysis, commit flow, and orphan recovery | | `compact.go` | Cold archive generation to JSONL gzip or zstd | Tests are organised in corresponding files: diff --git a/workspace.go b/workspace.go index 7bfb7e3..c0eed84 100644 --- a/workspace.go +++ b/workspace.go @@ -318,6 +318,9 @@ func (workspace *Workspace) Discard() { _ = workspace.closeAndRemoveFiles() } +// Query runs SQL against the buffer for ad-hoc analysis and returns rows as +// `[]map[string]any`. +// // Usage example: `result := workspace.Query("SELECT entry_kind, COUNT(*) AS count FROM workspace_entries GROUP BY entry_kind")` func (workspace *Workspace) Query(query string) core.Result { if err := workspace.ensureReady("store.Workspace.Query"); err != nil { -- 2.45.3