morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
morph::model::KeyedModel Concept Reference

Satisfied by model types that have a primary key, however it was named. More...

#include <model_key.hpp>

Concept definition

template<typename M>
concept KeyedModel = detail::SelfDeclaredKey<M> || detail::DeducedKey<M>
Satisfied by model types that have a primary key, however it was named.

Detailed Description

Satisfied by model types that have a primary key, however it was named.

Two ways in, and neither requires touching the model's own class body beyond the first: a nested PrimaryKey alias, or a BRIDGE_MODEL_KEY declaration, which deduces the type from the model field it is given (MemberTypeOf<decltype(MEMBER)>). Following morph::forms' standing rule — infer by default, declare to override — a nested alias wins when both are present, which is what lets a model whose key type differs from the field's type (an int column keyed as a std::string, say) state that explicitly.

Definition at line 120 of file model_key.hpp.