Repository navigation
Conversation
The `_orm_name`/`orm_name()` annotation, so far only honored at class scope for table and view names, now also names the column when placed on a non-static data member, both for reflected tables and views. * Rename `dbo_name_literal` to `mapped_name_literal` and move dev/schema/dbo_name.h to dev/schema/orm_name.h: the name is no longer only a database object's. * `resolve_mapped_name<refl>` falls back to the reflected identifier of any entity, class or member, replacing `extract_type_identifier`, and rejects more than one name annotation. * `make_reflected_column<member>` builds a column from a member's annotations; `make_reflected_table` uses it. * Reflected views honor member name annotations, which show in the CREATE VIEW column list, and reject column constraints instead of silently dropping them. Co-Authored-By: Claude Opus 5.5
A struct mapped by reflection may carry annotations of other libraries, e.g. for serialization. Until now these were spliced as table elements or column constraints and failed the definition's validation. An annotation now counts as sqlite_orm's own if its type is declared within namespace `sqlite_orm`; all others are skipped. sqlite_orm's own annotations are still validated by the factories consuming them, so a misplaced one remains a compile error. * `splice_annotations_within<refl, ns>` replaces `splice_annotations` and `extract_type_annotations`, built on `is_declared_within`, which judges a class template specialization by its template's scope. * `extract_orm_annotations<refl>` applies the `sqlite_orm` policy for reflected tables, columns and views. * Views accept a mapped name as their only sqlite_orm annotation, at class scope and on members, replacing the narrower column-constraint check. * The consteval `mapped_name_of<refl>` replaces `resolve_mapped_name`: it resolves the name entirely at compile time into a static string, so the factories' run-time code holds no reflection-dependent expression, which g++-16 rejects outside a constant-evaluated context. Co-Authored-By: Claude Opus 5.5
trueqbit
force-pushed
the
feature/reflected-column-names
branch
from
October 6, 2026 16:00
150b47a to
406997a
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
_orm_name/orm_name()annotation, so far only honored at class scope for the names of reflected tables and views, now also names a column when placed on a non-static data member:This works for
make_table<T>()andmake_view<T>()alike (a view's renamed columns appear in itsCREATE VIEWcolumn list), and for members inherited from base classes.In addition, reflected tables and views now ignore annotations of other libraries, so a struct can carry e.g. serialization annotations next to sqlite_orm's.
Changes
Column names from member annotations
dbo_name_literalis renamed tomapped_name_literal, anddev/schema/dbo_name.hmoves todev/schema/orm_name.h: the name is no longer only a database object's. The public spellings are unchanged.mapped_name_of<refl>resolves the name of any entity, class or member, entirely at compile time into a static string: the value of its name annotation, or its reflected identifier (replacingextract_type_identifier). It rejects more than one name annotation per entity. Run-time code of the factories therefore holds no reflection-dependent expression, which g++-16 rejects outside a constant-evaluated context.make_reflected_column<member>builds a column from a member's annotations;make_reflected_tableuses it.Annotations of other libraries
sqlite_orm(is_declared_within, which judges a class template specialization by its template's scope). All others are skipped.validate_column_definition,validate_base_table_definition), so a misplaced one remains a compile error.splice_annotations_within<refl, ns>replacessplice_annotations/extract_type_annotations;extract_orm_annotations<refl>applies thesqlite_ormpolicy.Tests
table_xinfo.CREATE VIEW).is_declared_within.🤖 Generated with Claude Code