Commit Graph

1521 Commits

Author SHA1 Message Date
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
silverqx dc4dd7c1c7 whitespaces 2023-06-28 14:07:24 +02:00
silverqx d10a72e359 removed todo tasks 2023-06-28 13:57:37 +02:00
silverqx 556eb8df00 made dozens of methods const 2023-06-28 13:55:15 +02:00
silverqx db3aa6bae9 used reserve 2023-06-28 13:51:13 +02:00
silverqx c483f7dc06 used static variable access 2023-06-28 13:50:44 +02:00
silverqx 19dafd27eb added inline 2023-06-28 13:48:55 +02:00
silverqx 3a04a1eca1 fixtypo 2023-06-28 13:48:30 +02:00
silverqx e695c3f5c9 added comment 2023-06-27 17:41:11 +02:00
silverqx 379916e4bf added section comment 2023-06-27 15:57:30 +02:00
silverqx 929ff261b9 whitespace 2023-06-27 15:46:40 +02:00
silverqx fc41152b55 made relation stores non-polymorphic
They don't need to be polymorphic as any method is not virtual and
stores are managed using shared_ptr-s.
2023-06-26 20:26:54 +02:00
silverqx 5fae87f8fc bugfix missing template parameter for toJson
Missing the PivotType to correctly serialize models collection
with belongs-to-many relations only, eg. after calling the getRelation()
or getRelationValue().
2023-06-26 14:39:20 +02:00
silverqx 14c67efb6f workaround for null QVariant bug for QJson 🫤
Fix the null QVariant bug for QJsonDocument, replace null QVariant-s
with the QVariant(nullptr).

The QJsonValue should return null for null QVariant-s but it doesn't,
even if the Qt's QJsonValue::fromVariant() documentation explicitly
states this behavior, it says: "If QVariant::isNull() returns true,
a null QJsonValue is returned or inserted into the list or object,
regardless of the type carried by QVariant.".

But this is not happening, it returns 0 for numbers, "" for QString and
QDateTime. 🫤

 - updated unit tests
 - added unit test method to test this behavior, to test null for all
   QVariant types
2023-06-26 09:09:59 +02:00
silverqx b06e00021d added support for U format in serialization
The toMap, toVector, and toJson accepts {CastType::CustomQDateTime, "U"}
and returns unixtimestamp.
2023-06-25 19:14:17 +02:00
silverqx de9cc281a9 changed defaults to Compact for toJson()
Changed from QJsonDocument::Indented to Compact.

 - updated docs
2023-06-25 16:42:43 +02:00
silverqx 987a989c7d bugfix in originalIsEquivalent() 2023-06-25 14:41:00 +02:00
silverqx 3e1be3b029 updated comment 2023-06-25 14:21:53 +02:00
silverqx 0cea374f53 fixtypo 2023-06-25 09:24:01 +02:00