Skip to content

docs: add usage examples and architecture guide (Phase 2)#22

Merged
AWaterColorPen merged 1 commit intomainfrom
feature/phase2-examples-and-architecture
Apr 22, 2026
Merged

docs: add usage examples and architecture guide (Phase 2)#22
AWaterColorPen merged 1 commit intomainfrom
feature/phase2-examples-and-architecture

Conversation

@AWaterColorPen
Copy link
Copy Markdown
Owner

Phase 2 — Usage Examples & Architecture Guide

This PR fills in the two stub docs added in the previous PR, replacing the placeholder content with complete documentation.

docs/examples.md — 7 real-world usage scenarios

  1. Simple single-table query (ClickHouse) — full working code + generated SQL
  2. Time-range filter with time_interval — shows auto-expansion to WHERE clause; includes a second example with extra filters, ORDER BY, and LIMIT
  3. Custom metrics formula — explains composition metrics (METRIC_DIVIDE, METRIC_ADD, etc.) with TOML schema + query + generated SQL
  4. Multi-table JOINfact_dimension_join with two chained dimension tables; schema, query, and generated SQL with JOIN chain
  5. RunSync vs RunChan — explains when to use each and the practical trade-offs
  6. Debug: BuildSQL — dry-run SQL inspection without executing; also shows Debug: true and SetLogger
  7. SQLite quick-start — local-only setup with test/dictionary.sqlite.toml; no ClickHouse needed

docs/architecture.md — contributor guide

  • Component responsibilities (Manager, Dictionary/Adapter, Translator, Clause/Statement, Clients, Result)
  • Full request lifecycle walkthrough (step-by-step from RunSync to rows)
  • Data-flow diagram (ASCII art)
  • Package layout table
  • Key design decisions (schema-driven, composition by name, GORM as dialect bridge, flat result model)
  • Extension points table (new DB, metric type, dimension type, filter operator, adapter, custom fragment)

Part of

Phase 2: Documentation — spec

- docs/examples.md: 7 real-world usage scenarios
  * Simple single-table ClickHouse query
  * Time-range filter with TimeInterval
  * Custom metrics formula (composition / ratio)
  * Multi-table JOIN (fact_dimension_join) query
  * RunSync vs RunChan (sync vs streaming)
  * Debug: BuildSQL without executing
  * SQLite quick-start for local development

- docs/architecture.md: contributor-focused architecture guide
  * Component responsibilities (Manager, Dictionary, Translator, Clause, Clients, Result)
  * Full request lifecycle walkthrough
  * Data-flow diagram
  * Package layout table
  * Key design decisions and extension points

- spec: mark examples and architecture tasks as done
@AWaterColorPen AWaterColorPen merged commit 49cfa88 into main Apr 22, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant