Commit Graph

1539 Commits

Author SHA1 Message Date
silverqx 0bb7a9c331 renamed exceptions 2023-07-11 17:37:28 +02:00
silverqx bf9706f808 updated comment 2023-07-11 17:19:50 +02:00
silverqx 41d2bfd0d6 modified exception messages 2023-07-11 17:18:55 +02:00
silverqx 411a635e6c added Appending Values To JSON support 🕺
These Appends are appended to the serialized models during the toMap(),
toVector(), or toJson() methods call.

Appends names are and must be mapped using the u_mutators hash map
(in the same way like u_relations) because c++ doesn't support advanced
reflection.

Appends are mapped to methods (can be protected) that return
the Casts::Attribute. This Casts::Attribute is a wrapper to return
a new attribute value.

Appends accept u_visible and u_hidden.

For the Appends that return QDate or QDateTime are the counterpart
serializeDate() or serializeDateTime() methods called.

 - added unit tests
2023-07-11 17:14:20 +02:00
silverqx 5aed31cbba fixtypo 2023-07-11 08:31:12 +02:00
silverqx fb8eaba926 updated comment 2023-07-11 08:31:12 +02:00
silverqx 1d95ef4694 fixtypo 2023-07-11 08:31:12 +02:00
silverqx 091a41e2b6 fixtypo 2023-07-11 08:31:12 +02:00
silverqx e1087f8fb7 fixtypo 2023-07-11 08:31:12 +02:00
silverqx dd279a97bb used likely and unlikely attributes in if 2023-07-11 08:31:11 +02:00
silverqx 1df4877224 fixtypo 2023-07-11 08:31:11 +02:00
silverqx 3f9ba894dd fixtypo 2023-07-11 08:31:11 +02:00
silverqx 6e1ba95995 return Derived & from setters 2023-07-11 08:31:11 +02:00
silverqx 414f967443 moved instantiation a little down 2023-07-11 08:31:11 +02:00
silverqx 5ed299f81a added and used HasReserveMethod concept
Used the HasReserveMethod concept instead of checking for a type.
2023-07-11 08:31:10 +02:00
silverqx d4444e4c28 added Hiding Attributes support
A user can define the u_visible and u_hidden std::set static data
member for visible and hidden attributes on his models and they will be
used during serialization.

The relationships and also u_snakeAttributes are correctly taken into
account.

 - added unit tests
 - added example to Models::Torrent
2023-07-11 08:31:06 +02:00
Alonso Schaich 8cdfb21159 include <variant> rather then prototyping std::variant (silverqx/TinyORM#13) (#15)
On libc++ based systems, the std::variant type provided by the <variant>
header is different to the one prototyped in ormconcepts.hpp, causing a
compilation failure.
2023-07-11 08:29:15 +02:00
silverqx 6b59612abb bump version to TinyORM v0.31.2 2023-07-08 14:20:49 +02:00
silverqx 7ea70b59a1 bump version to TinyORM v0.31.1 2023-07-07 18:31:09 +02:00
silverqx 06e4bef858 added missing comments 2023-07-07 14:52:30 +02:00
silverqx d84b23baa4 added section comment 2023-07-07 14:51:47 +02:00
silverqx 9b3d602208 updated comment 2023-07-07 14:51:47 +02:00
silverqx d59bff8bea extracted relations container type 2023-07-07 14:51:47 +02:00
silverqx ba35f156ec shorten namespace paths 2023-07-07 14:51:47 +02:00
silverqx 23aaca4501 bugfix used wrong attributesHash 2023-07-07 14:51:46 +02:00
silverqx 5da14390fe made method static 2023-07-07 14:51:46 +02:00
silverqx a2479cea72 renamed method parameter 2023-07-07 14:51:46 +02:00
silverqx e445713d20 bump version to TinyORM v0.31.0
Also bumped to TinyUtils v0.3.1.

 - added ModelsCollection 🔥🚀🎉
 - added Models and ModelsCollection serialization using toMap(),
   toVector(), and toJson() methods 🪡🔥❤️ (also supports pivot models)
 - changed container type for getOperators() to std::unordered_set
 - changed paging type to qint64 for paging-related methods like
   limit(), offset(), chunk(), take(), ...
 - added eagerLoadRelations<Model *>() and eagerLoadRelations(Model &)
   overloads
 - added Model getKeyCasted<T> and getAttribute<T> overloads

 - bugfix zero-initialized related models in belongs-to relations
 - bugfix select constraints and belongs-to-many

Internal:
 - extracted relation stores to own files
2023-07-03 16:03:11 +02:00
silverqx 1eea7298f2 fixed clang-tidy warning 2023-07-03 16:01:28 +02:00
silverqx 16fc5c337d whitespace 2023-07-03 16:01:07 +02:00
silverqx 1de438bb2e whitespace 2023-07-03 12:44:56 +02:00
silverqx e40284fde1 made visit() and all getters private in all stores 2023-07-03 10:17:01 +02:00
silverqx 3f9266275f made operator() protected 2023-07-03 09:48:03 +02:00
silverqx 56965d6299 added getters to all stores
Get rid of direct access to stores data members, used getters instead.
2023-07-03 09:41:41 +02:00
silverqx 4e8e37c8c1 made all visited() private 2023-07-02 20:36:34 +02:00
silverqx 5e8995872a removed section comments 2023-07-02 20:19:00 +02:00
silverqx eee702d0e7 cache result for BelongsToManyRelatedTableStore
Cache the related table name result to avoid visiting all over again.
2023-07-02 20:17:18 +02:00
silverqx 906ad87c52 updated section comment 2023-07-02 16:15:09 +02:00
silverqx 8c51bd89cb fixed gcc warning, renamed using alias 2023-07-02 07:49:01 +02:00
silverqx ad6fcd13f4 removed todo task 2023-07-01 20:10:25 +02:00
silverqx 75548057fe whitespaces 2023-07-01 19:51:21 +02:00
silverqx c51c401d4c added QtTimeZoneType for Qt metatype 2023-07-01 19:51:12 +02:00
silverqx 5b19afd61c add maybe_unused and assume(0) for prod. code 2023-07-01 19:08:49 +02:00
silverqx db5e243db7 extracted relation stores to own files
The big HasRelationStore class with nested classes is finally divided
into smaller pieces, every store is in its own file in the Support NS.

Performance is the same as the old code, thanks god. 🙏

mt new:  564
mt old:  565
st new:  959 294
st old:  959 305
2023-07-01 10:23:05 +02:00
silverqx 83f1c740db bugfix assert and init. in HasRelationStore 2023-07-01 08:11:38 +02:00
silverqx 0ee020d09e added section comment 2023-07-01 08:09:35 +02:00
silverqx fe56121649 changed order of friend declaration 2023-06-30 16:16:16 +02:00
silverqx 651594754d removed useless #include 2023-06-30 16:15:39 +02:00
silverqx aad52a89c8 changed qt_timezone default to Qt::UTC
Previously, it was the QtTimeZoneType::DontConvert that implied the
Qt::LocalTime timezone spec.

Setting this to the Qt::UTC by default is the only way to have the
maximum level of interoperability between TinyORM and other libraries
and services.

 - updated comments in docs and source code
2023-06-29 12:07:42 +02:00
silverqx 21530fa915 removed const in ModelsCollection callbacks
It allows to call eg. getRelationValue() inside these callbacks and
an user can also use const Model *const if needed, so it's much more
flexible.

Also I left const Model * in documentations, I didn't remove the const
from docs, it's on pupropse to show that it's possible.
2023-06-28 15:08:08 +02:00