Parameters of a described type: the common description of objects ( anch::Mapping<T> , anch-utils) registered for SQL.
More...
#include <fields.hpp>
Classes | |
| struct | Field |
| Field which has a value. More... | |
Public Member Functions | |
| const Field * | find (std::string_view name) const noexcept |
| const std::vector< Field > & | fields () const noexcept |
| template<typename P, typename... C> | |
| FieldsMapper< T > & | registerField (const std::string &name, P T::*member, C &&...) |
| template<typename P, typename... C> | |
| FieldsMapper< T > & | registerField (const std::string &name, std::function< P(const T &)> getter, C &&...) |
| template<typename P, typename... C> | |
| FieldsMapper< T > & | registerField (const std::string &, std::function< void(T &, const P &)>, C &&...) |
| template<typename P, typename... C> | |
| FieldsMapper< T > & | registerField (const std::string &name, std::function< P(const T &)> getter, std::function< void(T &, const P &)>, C &&...) |
Static Public Member Functions | |
| static const FieldsMapper< T > & | instance () |
Parameters of a described type: the common description of objects ( anch::Mapping<T> , anch-utils) registered for SQL.
Each field which has a value (member or getter) is a parameter named as the field: fields which are only written (setter) are ignored. Fields values have to be bindable ( Bindable : integers, floating point numbers, booleans, strings, dates ( anch::date::Date , anch::date::DateTime , anch::date::Time , std::chrono::sys_time ), anch::UUID (with ANCH_UUID ), std::optional and lists of them): a field of another type is refused at compile time. Constraints are not checked (validate objects with anch::val::validate ).
| T | the described type |
|
noexcept |
Fields getter
|
noexcept |
Find field
| name | the field name |
nullptr when T has no such field (or when it is only written)
|
static |
Mapper of T (built once)
| FieldsMapper< T > & anch::sql::FieldsMapper< T >::registerField | ( | const std::string & | , |
| std::function< void(T &, const P &)> | , | ||
| C && | ... ) |
Register field by setter: ignored (the field has no value)
| P | the field type |
| C | the constraints types |
this | FieldsMapper< T > & anch::sql::FieldsMapper< T >::registerField | ( | const std::string & | name, |
| P T::* | member, | ||
| C && | ... ) |
Register field by member
| P | the field type |
| C | the constraints types |
| name | the field name |
| member | the member |
this | FieldsMapper< T > & anch::sql::FieldsMapper< T >::registerField | ( | const std::string & | name, |
| std::function< P(const T &)> | getter, | ||
| C && | ... ) |
Register field by getter
| P | the field type |
| C | the constraints types |
| name | the field name |
| getter | the getter |
this | FieldsMapper< T > & anch::sql::FieldsMapper< T >::registerField | ( | const std::string & | name, |
| std::function< P(const T &)> | getter, | ||
| std::function< void(T &, const P &)> | , | ||
| C && | ... ) |
Register field by getter and setter (the getter gives the value)
| P | the field type |
| C | the constraints types |
| name | the field name |
| getter | the getter |
this