Lightweight 0.20260625.0
Loading...
Searching...
No Matches
Lightweight::RelationSelector Concept Reference

Constrains what may be used to single out one of several foreign keys into the same table. More...

#include <Record.hpp>

Concept definition

template<auto Selector>
std::same_as<std::remove_cvref_t<decltype(Selector)>, std::nullopt_t> || requires { std::string_view { Selector }; }
Constrains what may be used to single out one of several foreign keys into the same table.
Definition Record.hpp:132

Detailed Description

Constrains what may be used to single out one of several foreign keys into the same table.

Two forms are accepted:

  • std::nullopt (AutoDetectRelation) - resolve automatically; ambiguity is a compile error.
  • a SqlRealName (or anything convertible to std::string_view) - the SQL column name of the foreign key to use.

A relationship selector must stay inert at declaration time: the two records of a relationship reference each other, so neither is complete where the other is declared. That rules out pointer-to-member selectors and is why the foreign key is named by its column.

Definition at line 132 of file Record.hpp.