Commit Graph

920 Commits

Author SHA1 Message Date
silverqx 6b46304efc finished where tests
- whereColumn, whereNull, whereIn and vector, "or" and "not" shortcuts
 - added few where shortcuts to the query builder orWhereColumn, ...
2021-03-26 18:07:11 +01:00
silverqx 8fd5cfcf26 Expression moved to Query::Expression 2021-03-26 18:07:11 +01:00
silverqx 626ec286e1 changed position of join methods in query builder 2021-03-26 18:07:10 +01:00
silverqx e190fe7c41 added first unit tests
- select, addSelect, distinct, limit, offset, forPage, take, skip,
   basicWhere, latest, oldest, orderBy, from and table
 - functional tests limit and find
 - new query builder methods select and addSelect
 - finished missing docs comments in query builder
2021-03-26 18:07:10 +01:00
silverqx 881b273945 added mysql test data 2021-03-26 18:07:10 +01:00
silverqx 423de22bd5 fixed tests after improved db connection code 2021-03-26 18:07:10 +01:00
silverqx af44317a49 improved connection to the database
- added create() factory method to create DatabaseConnection from
   config QVariantHash
 - configurable charset, collation, timezone, QSqlDatabase options,
   strict mode, sql modes
 - for now all this code is in the DatabseConnection ctor :/
 - added selectOne() and table() to the DatabaseConnection
 - solved db connection in tests, connection code moved to database
   Utils shared library
 - for now only one db is supported in tests and actually in main
   library too and it is MySQL server
 - modified EntityManager to use this new connection code, has two
   ctors, one takes DatabaseConnection reference and other QVariantHash
   config hash
 - added create() factory method to create EntityManager from config
   QVariantHash
2021-03-26 18:05:10 +01:00
silverqx e6425a535c added utils library for tests 2021-03-26 17:59:00 +01:00
silverqx f0d00c9971 changed header files extension to hpp 2021-03-26 17:58:59 +01:00
silverqx 76397391d9 separated source and header files
Source files are located in src/ folder and header files in include/
folder.
2021-03-26 17:58:59 +01:00
silverqx b633a22294 define renamed to TINYORM_COMMON_NAMESPACE 2021-03-26 17:58:59 +01:00
silverqx a809798e6e added tests, refactored project structure
- TinyOrm is shared library now in src/ folder
 - added tests/ folder as subdirs project
 - some init tests for QueryBuilder and DatabaseConnection
 - renamed MANGO_DEBUG_SQL to TINYORM_DEBUG_SQL
2021-03-26 17:58:59 +01:00
silverqx 3aee49ce8d qt6 support 2021-03-26 17:58:59 +01:00
silverqx 1fa7b73797 recursively saving models & relationships
this commit contains few bigger changes:

 - added push method
 - unified relationVisitor() for models
 - added relation store for nicer api for end users
 - getRelation()/getRelationValue() return pointers to models, which
   points directly to relationships data member, so user can directly
   modify this models and push/save afterward
 - relation ctors take related instance as first parameter instead of
   TinyBuilder of related model
 -
2021-03-26 17:58:59 +01:00
silverqx b77dd38627 added methods for retrieving single models
firstOrNew, firstOrCreate, find, firstWhere, firstWhereEq

Following methods was needed to implement for above methods:
where, whereEq and where(QVector<WhereItem>  &)

Corresponding methods also added to Tiny/QueryBuilder.
2021-03-26 17:58:59 +01:00
silverqx eb787b77ed added updating models 2021-03-26 17:58:58 +01:00
silverqx 5d2f3b3a61 added inserting models 2021-03-26 17:58:58 +01:00
silverqx 34bee1062c added support for deleting models
remove(), deleteModels() and destroy() methods
2021-03-26 17:58:58 +01:00
silverqx 3132a2bcd1 utils moved to MANGO_COMMON_NAMESPACE 2021-03-26 17:58:58 +01:00
silverqx c9a7521445 initial commit 2021-03-26 17:58:14 +01:00