|
Lightweight 0.20260921.0
|
One inverse or through relation to emit on a record. More...
#include <CxxModelPrinter.hpp>
Public Types | |
| enum class | Kind : uint8_t { HasMany , HasOne , HasManyThrough , HasOneThrough } |
| Which relation template to emit. More... | |
Public Attributes | |
| Kind | kind {} |
| Which relation template to emit for this relation. | |
| std::string | ownerTable |
| Table this relation is emitted on. | |
| std::string | referencedTable |
| std::string | throughTable |
| Join table, for the through relations only; empty otherwise. | |
| std::string | ownerForeignKeyColumn |
| std::string | referencedForeignKeyColumn |
| Foreign key column linking the join record to the far table; empty for HasMany/HasOne. | |
| bool | ownerSelectorRequired {} |
| bool | referencedSelectorRequired {} |
| As ownerSelectorRequired, for referencedForeignKeyColumn. | |
| std::string | memberName |
| Member name to emit, already sanitized and formatted. | |
One inverse or through relation to emit on a record.
A BelongsTo is derivable from the child table alone, but every relation pointing the other way needs to know about foreign keys declared on other tables. RelationPlan is that schema-wide answer, computed once by PlanRelations and consumed per table.
Definition at line 103 of file CxxModelPrinter.hpp.
|
strong |
Which relation template to emit.
| Enumerator | |
|---|---|
| HasMany | One-to-many: the inverse of a child's BelongsTo. |
| HasOne | One-to-one: as HasMany, but the child's foreign key is uniquely indexed. |
| HasManyThrough | Many-to-many across a join table. |
| HasOneThrough | As HasManyThrough, but the far side is uniquely indexed. |
Definition at line 106 of file CxxModelPrinter.hpp.
| Kind Lightweight::Tools::CxxModelPrinter::PlannedRelation::kind {} |
Which relation template to emit for this relation.
Definition at line 115 of file CxxModelPrinter.hpp.
| std::string Lightweight::Tools::CxxModelPrinter::PlannedRelation::ownerTable |
Table this relation is emitted on.
Definition at line 118 of file CxxModelPrinter.hpp.
| std::string Lightweight::Tools::CxxModelPrinter::PlannedRelation::referencedTable |
The record the relation yields: the child table for HasMany/HasOne, the far table for the through relations.
Definition at line 122 of file CxxModelPrinter.hpp.
| std::string Lightweight::Tools::CxxModelPrinter::PlannedRelation::throughTable |
Join table, for the through relations only; empty otherwise.
Definition at line 125 of file CxxModelPrinter.hpp.
| std::string Lightweight::Tools::CxxModelPrinter::PlannedRelation::ownerForeignKeyColumn |
Foreign key column linking the child (or join record) back to the owner. Emitted as a SqlRealName selector so that several foreign keys into one table stay distinguishable.
Definition at line 129 of file CxxModelPrinter.hpp.
| std::string Lightweight::Tools::CxxModelPrinter::PlannedRelation::referencedForeignKeyColumn |
Foreign key column linking the join record to the far table; empty for HasMany/HasOne.
Definition at line 132 of file CxxModelPrinter.hpp.
| bool Lightweight::Tools::CxxModelPrinter::PlannedRelation::ownerSelectorRequired {} |
Whether a selector must be emitted for ownerForeignKeyColumn. It is required when the owner is reachable from the same child table through more than one foreign key, and is harmless otherwise - but emitting it unconditionally would churn every generated header, so it is tracked.
Definition at line 138 of file CxxModelPrinter.hpp.
| bool Lightweight::Tools::CxxModelPrinter::PlannedRelation::referencedSelectorRequired {} |
As ownerSelectorRequired, for referencedForeignKeyColumn.
Definition at line 141 of file CxxModelPrinter.hpp.
| std::string Lightweight::Tools::CxxModelPrinter::PlannedRelation::memberName |
Member name to emit, already sanitized and formatted.
Definition at line 144 of file CxxModelPrinter.hpp.