29#include "sql/parameters.hpp"
50 template<anch::Described T>
68 std::vector<Field> _fields;
86 static const FieldsMapper<T>&
instance();
95 const Field*
find(std::string_view name)
const noexcept;
102 const std::vector<Field>&
fields() const noexcept;
116 template<typename P, typename... C>
117 FieldsMapper<T>&
registerField(const std::
string& name, P T::* member, C&&...);
130 template<typename P, typename... C>
131 FieldsMapper<T>&
registerField(const std::
string& name, std::function<P(const T&)> getter, C&&...);
141 template<typename P, typename... C>
142 FieldsMapper<T>&
registerField(const std::
string&, std::function<
void(T&, const P&)>, C&&...);
155 template<typename P, typename... C>
156 FieldsMapper<T>&
registerField(const std::
string& name, std::function<P(const T&)> getter, std::function<
void(T&, const P&)>, C&&...);
185 explicit FieldsOf(
const T&
object)
noexcept;
195 const T&
object()
const noexcept;
214 template<anch::Described T>
222 template<anch::Described T>
223 FieldsMapper<T>::FieldsMapper(): _fields() {
227 template<anch::Described T>
228 const FieldsMapper<T>&
230 static const FieldsMapper<T> mapper;
234 template<anch::Described T>
237 for(
const Field& field : _fields) {
238 if(field.name == name) {
245 template<anch::Described T>
246 const std::vector<typename FieldsMapper<T>::Field>&
251 template<anch::Described T>
252 template<
typename P,
typename... C>
256 " UUID, std::optional and lists of them: this field of the description can not be bound");
261 template<anch::Described T>
262 template<
typename P,
typename... C>
266 " UUID, std::optional and lists of them: this field of the description can not be bound");
271 template<anch::Described T>
272 template<
typename P,
typename... C>
278 template<anch::Described T>
279 template<
typename P,
typename... C>
287 template<anch::Described T>
292 template<anch::Described T>
298 template<anch::Described T>
Parameters of a described type: the common description of objects ( anch::Mapping<T> ,...
Definition fields.hpp:51
static const FieldsMapper< T > & instance()
Definition fields.hpp:229
const std::vector< Field > & fields() const noexcept
Definition fields.hpp:247
const Field * find(std::string_view name) const noexcept
Definition fields.hpp:236
FieldsMapper< T > & registerField(const std::string &name, P T::*member, C &&...)
Definition fields.hpp:254
Fields of an object, bound to the parameters of a query with the same names ( fieldsOf ).
Definition fields.hpp:170
const T & object() const noexcept
Definition fields.hpp:294
FieldsOf(const T &object) noexcept
Definition fields.hpp:288
Type described by an anch::Mapping specialization.
Definition mapping.hpp:66
Definition parameters.hpp:293
SQL namespace.
Definition clauses.hpp:28
anch::sql::BoundValue toBound(const T &value)
Definition parameters.hpp:474
anch::sql::FieldsOf< T > fieldsOf(const T &object) noexcept
Definition fields.hpp:300
AnCH framework base namespace.
Definition app.hpp:30
Value bound to a parameter: value, or list of values.
Definition parameters.hpp:318
Field which has a value.
Definition fields.hpp:57
std::string name
Definition fields.hpp:59
std::function< anch::sql::BoundValue(const T &)> read
Definition fields.hpp:62