Commit Graph

1470 Commits

Author SHA1 Message Date
silverqx 4ae13438db removed todo task 2023-06-23 14:06:03 +02:00
silverqx 1b0ccb9721 whitespace 2023-06-22 09:06:33 +02:00
silverqx 06647e8b38 added models serialization to JSON 🔥🚀
It serializes complete models and model collections with all relations
including pivot models.

 - added unit tests
2023-06-20 14:13:51 +02:00
silverqx b67f25807f removed unused #include 2023-06-19 16:49:11 +02:00
silverqx 1be83c85db added comment 2023-06-19 14:26:27 +02:00
silverqx 7d83572bbc added user serialization override support
The user can override serializing of date and datetime, each separately.

 - added unit tests
2023-06-19 08:44:53 +02:00
silverqx b41c92fe90 whitespaces 2023-06-18 22:33:34 +02:00
silverqx 74906ebb86 allowed serializeDate/Time() override
The user can override these methods in the Derived models.
2023-06-18 22:29:06 +02:00
silverqx ba3e9560d9 bugfix Model::operator==()
Thanks to the CRTP the user doesn't have to define operator==() in every
model, the u_xyz data members are compared here. I don't like it though,
one caveat of this is that if a user defines the operator==() then these
data members will be compared twice.
2023-06-18 21:53:50 +02:00
silverqx 53bf8cedb7 fixtypo 2023-06-18 21:31:06 +02:00
silverqx fa257e4121 added [[noreturn]] attribute to throw methods 2023-06-18 18:08:17 +02:00
silverqx 0a8ac83b20 added IWYU pragma 2023-06-18 17:43:29 +02:00
silverqx cffc9623ec wrapped registerQMetaTypesForQt5() in #if 2023-06-18 16:32:39 +02:00
silverqx e28c4e990a called Q_DECLARE_METATYPE only for Qt 5 2023-06-18 16:32:05 +02:00
silverqx 03ff6d0fb7 registered QMetaType equal comparators 2023-06-18 16:22:52 +02:00
silverqx 1ebae9524f added Q_DECLARE_METATYPE for Qt 5 2023-06-18 14:43:50 +02:00
silverqx 1a9d0d1143 used QVector::size_type in HasAttributes 2023-06-17 20:55:27 +02:00
silverqx 268a9371e8 added typename 2023-06-17 20:54:55 +02:00
silverqx 8f68b8e0a1 removed useless typename 2023-06-17 19:50:11 +02:00
silverqx 4b66906ae5 whitespace 2023-06-17 19:45:13 +02:00
silverqx a5fc09a4fb bugfix select constraints and belongs-to-many
I have to write a note here, this !relation.name.contains(DOT) bugfix
was unbelievable, it took me a whole day of debugging, writing unit
tests, and figuring out how to solve this problem. I wrote dozen of
lines to make it work but at the end I started removing what was not
needed and ended with this one condition. 😮🙃 If the relation name is a
nested relation, then the select constraints lambda will not be
generated and will be nullptr, so will be skipped here, the problem was
that the getRelatedTableForBelongsToManyWithVisitor() could not be
invoked correctly because it's a nested relation. The
getRelatedTableForBelongsToManyWithVisitor() will be visited or resolved
later, right before it will be needed and it will be done during
relation->getQuery().with(std::move(nested)); in the
eagerLoadRelationVisited(), the magic is done in the
relationsNestedUnder() when the nested relation is unwrapped.

 - added bunch of unit tests for this case
2023-06-17 19:32:30 +02:00
silverqx db28ad3d3e used emplaceBack on Qt 6 2023-06-17 17:31:33 +02:00
silverqx a289faf0d8 added const to ModelsCollection methods
Revisited all methods.
2023-06-16 16:59:23 +02:00
silverqx d724527bb3 used emplaceBack for Qt containers 2023-06-16 16:22:46 +02:00
silverqx 49e24c0c16 added HASH_ global string constant for "hash" 2023-06-16 15:09:58 +02:00
silverqx d385e1be24 added noexcept to getUserXyz() getters 2023-06-16 14:51:03 +02:00
silverqx 9b2159df94 added pivots support for toMap and toVector 💪
The Model toMap and toVector now correctly serializes also the Pivot
models with the belongs-to-many relations.

 - added many unit tests
2023-06-16 14:45:40 +02:00
silverqx 200b4939ac extracted constexpr method 2023-06-15 16:45:23 +02:00
silverqx f8f0780a98 serialize relations (without pivot)
- added unit tests
2023-06-15 09:28:32 +02:00
silverqx db6b48e1fa whitespace 2023-06-15 09:25:21 +02:00
silverqx 572bce614d updated section comments 2023-06-15 09:22:19 +02:00
silverqx 8181c4e7e8 removed useless inline 2023-06-14 22:46:35 +02:00
silverqx 401dd6bdc0 made some methods const 2023-06-14 15:25:56 +02:00
silverqx d49ec5b3af removed todo task
[skip ci]
2023-06-13 16:52:59 +02:00
silverqx fc2c376c05 added ModelsCollection toVector() and toMap()
- added unit tests
 - bugfix previous toVector()
2023-06-13 14:32:16 +02:00
silverqx 506406930d added ModelsCollection::toVector()
It's alias to the all().
2023-06-13 13:20:04 +02:00
silverqx 02d540fc75 extracted common logic to private method 2023-06-13 12:48:35 +02:00
silverqx 2e09234fb6 added Model toMap() and toVector()
- added unit tests
2023-06-13 09:54:03 +02:00
silverqx 14fda230bc changed method order
[skip ci]
2023-06-13 09:23:10 +02:00
silverqx 76c19cd26f added section comment
[skip ci]
2023-06-13 09:22:10 +02:00
silverqx 0a0a5f3e85 updated comment
[skip ci]
2023-06-13 08:42:32 +02:00
silverqx 814ea5d5b3 updated todo task
[skip ci]
2023-06-06 13:53:19 +02:00
silverqx e7c070534f whitespaces
[skip ci]
2023-06-06 13:52:51 +02:00
silverqx 50033a309e added ModelsCollection all() and toBase()
- added unit tests
2023-06-04 19:17:01 +02:00
silverqx 7401b6cb91 whitespace 2023-06-04 08:35:46 +02:00
silverqx 416b5b72d0 whitespace 2023-06-03 19:58:56 +02:00
silverqx bcdc74067a whitespace 2023-06-03 19:12:12 +02:00
silverqx 6514d142a6 enabled new features with clang >=16
The following problems were fixed in clang 16:

 - aggregate initialization was fixed
 - concepts were fixed
2023-06-03 19:08:36 +02:00
silverqx b375adf30b whitespace 2023-06-03 13:58:26 +02:00
silverqx 2a05beab99 bugfix removed semicolon 2023-06-03 13:08:10 +02:00