Skip to content

docs(orm): document ORM framework (entity.h, ENTITY_TABLE/ENTITY_FIELD macros)#358

Merged
kcenon merged 2 commits into
mainfrom
docs/issue-354-document-orm-framework
Feb 8, 2026
Merged

docs(orm): document ORM framework (entity.h, ENTITY_TABLE/ENTITY_FIELD macros)#358
kcenon merged 2 commits into
mainfrom
docs/issue-354-document-orm-framework

Conversation

@kcenon

@kcenon kcenon commented Feb 8, 2026

Copy link
Copy Markdown
Owner

Closes #354

Summary

  • Add comprehensive ORM framework guide at docs/ORM_GUIDE.md covering entity definition, macro system, CRUD operations, query builder, schema management, and limitations
  • Update docs/API_REFERENCE.md with corrected ORM examples and cross-reference to the new guide

Changes

New Files

  • docs/ORM_GUIDE.md — Complete ORM documentation with:
    • Design philosophy (Active Record pattern)
    • Macro reference: ENTITY_TABLE, ENTITY_FIELD, ENTITY_METADATA with exact syntax
    • C++ to SQL type mapping table (6 supported types)
    • 7 field constraint functions with composition examples
    • CRUD operation examples
    • Query builder API: where, order_by, limit/offset, joins, aggregations
    • Schema management (create_tables, drop_tables, sync_schema)
    • Metadata system API (field_metadata, entity_metadata, entity_manager)
    • 2 complete entity examples (User, Post with foreign key)
    • Generated SQL examples
    • Limitations table with workarounds (including thread-safety note)

Modified Files

  • docs/API_REFERENCE.md — Updated ORM section with correct entity_manager usage pattern and link to guide

Test Plan

  • Build succeeds (cmake --build passes)
  • Documentation renders correctly on GitHub (28 code blocks, 9 tables, 36 TOC anchors verified)
  • Links between documents resolve correctly (4/4 cross-document links verified)
  • Code examples are consistent with source API (all types, constraints, macros, methods verified against entity.h/entity.cpp — 1 thread-safety inaccuracy found and fixed in second commit)

Document the ORM framework including entity definition macros
(ENTITY_TABLE, ENTITY_FIELD, ENTITY_METADATA), supported types
and SQL mapping, field constraints, CRUD operations, query builder
API, schema management, metadata system, and limitations.
Update API_REFERENCE.md with corrected ORM examples and cross-reference.
The ENTITY_METADATA lazy initialization uses a non-atomic static bool,
which is not thread-safe. Update documentation to accurately describe
the behavior and add it to the limitations table.
@kcenon kcenon merged commit 3a26708 into main Feb 8, 2026
23 checks passed
@kcenon kcenon deleted the docs/issue-354-document-orm-framework branch February 8, 2026 15:15
kcenon added a commit that referenced this pull request Apr 13, 2026
…D macros) (#358)

* docs(orm): add comprehensive ORM framework guide (#354)

Document the ORM framework including entity definition macros
(ENTITY_TABLE, ENTITY_FIELD, ENTITY_METADATA), supported types
and SQL mapping, field constraints, CRUD operations, query builder
API, schema management, metadata system, and limitations.
Update API_REFERENCE.md with corrected ORM examples and cross-reference.

* docs(orm): fix inaccurate thread-safety claim in ENTITY_METADATA docs

The ENTITY_METADATA lazy initialization uses a non-atomic static bool,
which is not thread-safe. Update documentation to accurately describe
the behavior and add it to the limitations table.
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.

[Task] docs: Document ORM framework (entity.h, ENTITY_TABLE/ENTITY_FIELD macros)

1 participant