mirror of
https://github.com/silverqx/TinyORM.git
synced 2026-05-24 19:58:22 -05:00
added new todo keyword FEATURE
Updated all appropriate todos to the new FEATURE keyword.
This commit is contained in:
@@ -65,7 +65,7 @@ Features related/to implement:
|
||||
- multidriver : task related to adding support for another drivers PostgreSQL, SQLite and SQL Server
|
||||
- pivot : pivot table in the many-to-many relationship
|
||||
- postgres : specific to PostgreSQL server
|
||||
- primarykey dilema : different types for primary keys
|
||||
- dilemma primarykey : different types for primary keys
|
||||
- relations : relations related 🤓
|
||||
- scopes : query scopes
|
||||
- table prefix : table prefix in the query grammar
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Orm
|
||||
/*! Get a new query builder instance. */
|
||||
QSharedPointer<QueryBuilder> query() override;
|
||||
|
||||
// TODO dilemma Raw Expressions fuckup🤔 silverqx
|
||||
// FEATURE dilemma Raw Expressions fuckup🤔 silverqx
|
||||
/*! Get a new raw query expression. */
|
||||
inline Query::Expression raw(const QVariant &value) const override
|
||||
{ return value; }
|
||||
@@ -222,8 +222,7 @@ namespace Orm
|
||||
std::function<Connectors::ConnectionName()> m_qtConnectionResolver;
|
||||
/*! The name of the connected database. */
|
||||
const QString m_database;
|
||||
// CUR change all todo tasks for features to the format below silverqx
|
||||
// TODO feature, table prefix silverqx
|
||||
// FEATURE table prefix silverqx
|
||||
/*! The table prefix for the connection. */
|
||||
const QString m_tablePrefix {""};
|
||||
/*! The database connection configuration options. */
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Orm::Query::Grammars
|
||||
virtual QString
|
||||
compileInsertOrIgnore(const QueryBuilder &query,
|
||||
const QVector<QVariantMap> &values) const;
|
||||
// TODO postgres, sequence silverqx
|
||||
// FEATURE postgres, sequence silverqx
|
||||
/*! Compile an insert and get ID statement into SQL. */
|
||||
inline QString
|
||||
compileInsertGetId(const QueryBuilder &query,
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Grammars
|
||||
}
|
||||
using QueryGrammar = Query::Grammars::Grammar;
|
||||
|
||||
// TODO add support for subqueries, first in where() silverqx
|
||||
// FEATURE subqueries, add support for subqueries, first in where() silverqx
|
||||
// TODO add inRandomOrder() silverqx
|
||||
class SHAREDLIB_EXPORT Builder
|
||||
{
|
||||
@@ -71,8 +71,8 @@ namespace Grammars
|
||||
/*! Insert a new record into the database while ignoring errors. */
|
||||
std::tuple<int, std::optional<QSqlQuery>>
|
||||
insertOrIgnore(const QVariantMap &values);
|
||||
// TODO postgres, support sequence, add sequence parameter silverqx
|
||||
// TODO dilemma primarykey, add support for Model::KeyType in QueryBuilder/TinyBuilder or should it be QVariant and runtime type check? 🤔 silverqx
|
||||
// FEATURE postgres, support sequence, add sequence parameter silverqx
|
||||
// FEATURE dilemma primarykey, add support for Model::KeyType in QueryBuilder/TinyBuilder or should it be QVariant and runtime type check? 🤔 silverqx
|
||||
/*! Insert a new record and get the value of the primary key. */
|
||||
quint64 insertGetId(const QVariantMap &values);
|
||||
|
||||
|
||||
@@ -60,11 +60,11 @@ namespace Relations {
|
||||
// TODO model missing methods Model::loadMissing() silverqx
|
||||
// TODO model missing methods Model::whereExists() silverqx
|
||||
// TODO model missing methods Model::whereBetween() silverqx
|
||||
// TODO next Constraining Eager Loads silverqx
|
||||
// FEATURE next Constraining Eager Loads silverqx
|
||||
// TODO perf add pragma once to every header file, have branch pragma-once, but I can't get rid of the clang warning -Wpragma-once-outside-header in every file, I tried everything 😞 silverqx
|
||||
// TODO future try to compile every header file by itself and catch up missing dependencies and forward declaration, every header file should be compilable by itself silverqx
|
||||
// TODO future include every stl dependency in header files silverqx
|
||||
// TODO logging, add support for custom logging, logging to the defined stream?, I don't exactly know how I will solve this issue, design it 🤔 silverqx
|
||||
// FEATURE logging, add support for custom logging, logging to the defined stream?, I don't exactly know how I will solve this issue, design it 🤔 silverqx
|
||||
template<typename Model, typename ...AllRelations>
|
||||
class BaseModel :
|
||||
public Concerns::HasRelationStore<Model, AllRelations...>,
|
||||
@@ -1228,7 +1228,7 @@ namespace Relations {
|
||||
return query()->insert(attributes);
|
||||
}
|
||||
|
||||
// TODO dilemma primarykey, Model::KeyType vs QVariant silverqx
|
||||
// FEATURE dilemma primarykey, Model::KeyType vs QVariant silverqx
|
||||
template<typename Model, typename ...AllRelations>
|
||||
quint64
|
||||
BaseModel<Model, AllRelations...>::insertGetId(
|
||||
@@ -1245,7 +1245,7 @@ namespace Relations {
|
||||
}
|
||||
|
||||
// TODO cpp check all int types and use std::size_t where appropriate silverqx
|
||||
// TODO dilemma primarykey, id should be Model::KeyType, if I don't solve this problem, do runtime type check, QVariant type has to be the same type like KeyType and throw exception silverqx
|
||||
// FEATURE dilemma primarykey, id should be Model::KeyType, if I don't solve this problem, do runtime type check, QVariant type has to be the same type like KeyType and throw exception silverqx
|
||||
// TODO next test all this remove()/destroy() methods, when deletion fails silverqx
|
||||
template<typename Model, typename ...AllRelations>
|
||||
size_t
|
||||
@@ -2432,7 +2432,7 @@ namespace Relations {
|
||||
Model &
|
||||
BaseModel<Model, AllRelations...>::fill(const QVector<AttributeItem> &attributes)
|
||||
{
|
||||
// TODO guarded silverqx
|
||||
// FEATURE guarded silverqx
|
||||
for (const auto &attribute : attributes)
|
||||
setAttribute(attribute.key, attribute.value);
|
||||
|
||||
@@ -2443,7 +2443,7 @@ namespace Relations {
|
||||
Model &
|
||||
BaseModel<Model, AllRelations...>::fill(QVector<AttributeItem> &&attributes)
|
||||
{
|
||||
// TODO guarded silverqx
|
||||
// FEATURE guarded silverqx
|
||||
for (auto &attribute : attributes)
|
||||
setAttribute(std::move(attribute.key), std::move(attribute.value));
|
||||
|
||||
@@ -2454,7 +2454,7 @@ namespace Relations {
|
||||
Model &
|
||||
BaseModel<Model, AllRelations...>::forceFill(const QVector<AttributeItem> &attributes)
|
||||
{
|
||||
// TODO guarded silverqx
|
||||
// FEATURE guarded silverqx
|
||||
return fill(attributes);
|
||||
}
|
||||
|
||||
@@ -3687,13 +3687,13 @@ namespace Relations {
|
||||
syncOriginal();
|
||||
}
|
||||
|
||||
// TODO dilemma primarykey, add support for Model::KeyType silverqx
|
||||
// FEATURE dilemma primarykey, add support for Model::KeyType silverqx
|
||||
template<typename Model, typename ...AllRelations>
|
||||
quint64 BaseModel<Model, AllRelations...>::insertAndSetId(
|
||||
const TinyBuilder<Model> &query,
|
||||
const QVector<AttributeItem> &attributes)
|
||||
{
|
||||
// TODO postgres, insertGetId() and getKeyName() for sequence parameter silverqx
|
||||
// FEATURE postgres, insertGetId() and getKeyName() for sequence parameter silverqx
|
||||
// const auto &keyName = getKeyName();
|
||||
|
||||
const auto id = query.insertGetId(attributes/*, keyName*/);
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Orm::Tiny
|
||||
class SHAREDLIB_EXPORT ModelNotFoundError : public RuntimeError
|
||||
{
|
||||
public:
|
||||
// TODO dilemma primarykey, Model::KeyType vs QVariant silverqx
|
||||
// FEATURE dilemma primarykey, Model::KeyType vs QVariant silverqx
|
||||
// TODO perf add overload ctor for QVector<quint64>, better QVector<Model::KeyType> silverqx
|
||||
explicit ModelNotFoundError(const char *model,
|
||||
const QVector<QVariant> &ids = {});
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace Orm::Tiny::Relations
|
||||
|
||||
/*! Indicates if the ID is auto-incrementing. */
|
||||
bool u_incrementing = false;
|
||||
// TODO guarded silverqx
|
||||
// FEATURE guarded silverqx
|
||||
/*! The attributes that aren't mass assignable. */
|
||||
// QStringList u_guarded;
|
||||
|
||||
@@ -180,7 +180,7 @@ namespace Orm::Tiny::Relations
|
||||
if (attributesContainsKey)
|
||||
return BaseModel<PivotModel>::remove();
|
||||
|
||||
// TODO events silverqx
|
||||
// FEATURE events silverqx
|
||||
// if (fireModelEvent("deleting") == false)
|
||||
// return false;
|
||||
|
||||
@@ -192,7 +192,7 @@ namespace Orm::Tiny::Relations
|
||||
|
||||
this->exists = false;
|
||||
|
||||
// TODO events silverqx
|
||||
// FEATURE events silverqx
|
||||
// fireModelEvent("deleted", false);
|
||||
|
||||
return affected > 0 ? true : false;
|
||||
|
||||
@@ -120,13 +120,13 @@ namespace Orm::Tiny::Relations
|
||||
return m_child;
|
||||
}
|
||||
|
||||
// TODO dilemma primarykey, Model::KeyType vs QVariant silverqx
|
||||
// FEATURE dilemma primarykey, Model::KeyType vs QVariant silverqx
|
||||
template<class Model, class Related>
|
||||
Model &BelongsTo<Model, Related>::associate(const QVariant &id) const
|
||||
{
|
||||
m_child.setAttribute(m_foreignKey, id);
|
||||
|
||||
// TODO relations, check if relation is loaded and if has the same id, if so, then don't unset relation silverqx
|
||||
// FEATURE relations, check if relation is loaded and if has the same id, if so, then don't unset relation silverqx
|
||||
m_child.unsetRelation(m_relationName);
|
||||
|
||||
return m_child;
|
||||
@@ -136,7 +136,7 @@ namespace Orm::Tiny::Relations
|
||||
Model &BelongsTo<Model, Related>::dissociate() const
|
||||
{
|
||||
// TODO test Model::save with null key silverqx
|
||||
// TODO dilemma primarykey, Model::KeyType vs QVariant, set to null, will be different for Qt5 (QVariant(QVariant::Type(qMetaTypeId<Model::KeyType>()))) and Qt6 (QVariant(QMetaType(qMetaTypeId<Model::KeyType>())))) ; ALSO current problem is, that I check that foreignKey !isValid || isNull, but when QVariant with type (Model::KeyType) and also with null is created by the above commands, then it is still null (isNull == true), but is considered as !!VALID!! (isValid == true) silverqx
|
||||
// FEATURE dilemma primarykey, Model::KeyType vs QVariant, set to null, will be different for Qt5 (QVariant(QVariant::Type(qMetaTypeId<Model::KeyType>()))) and Qt6 (QVariant(QMetaType(qMetaTypeId<Model::KeyType>())))) ; ALSO current problem is, that I check that foreignKey !isValid || isNull, but when QVariant with type (Model::KeyType) and also with null is created by the above commands, then it is still null (isNull == true), but is considered as !!VALID!! (isValid == true) silverqx
|
||||
m_child.setAttribute(m_foreignKey, {});
|
||||
|
||||
// TODO test operations that are related on the BaseModel::m_relation data member how they behave, when m_relations value contains the std::nullopt value silverqx
|
||||
|
||||
@@ -475,7 +475,7 @@ namespace Orm::Tiny::Relations
|
||||
/* First we'll add the proper select columns onto the query so it is run with
|
||||
the proper columns. Then, we will get the results and hydrate out pivot
|
||||
models with the result of those columns as a separate model relation. */
|
||||
// TODO scopes silverqx
|
||||
// FEATURE scopes silverqx
|
||||
// $builder = $this->query->applyScopes();
|
||||
|
||||
auto l_columns = this->m_query->getQuery().getColumns().isEmpty()
|
||||
@@ -645,7 +645,7 @@ namespace Orm::Tiny::Relations
|
||||
// Ownership of the QSharedPointer<QueryBuilder>
|
||||
auto query = newPivotStatement();
|
||||
|
||||
// TODO relations, add support for BelongsToMany::where/whereIn/whereNull silverqx
|
||||
// FEATURE relations, add support for BelongsToMany::where/whereIn/whereNull silverqx
|
||||
// for (auto &[column, value, comparison, condition] : m_pivotWheres)
|
||||
// query->where(column, value, comparison, condition);
|
||||
|
||||
@@ -735,7 +735,7 @@ namespace Orm::Tiny::Relations
|
||||
attach(QVector {model.getAttribute(m_relatedKey)}, attributes, touch);
|
||||
}
|
||||
|
||||
// TODO dilemma primarykey, Model::KeyType vs QVariant silverqx
|
||||
// FEATURE dilemma primarykey, Model::KeyType vs QVariant silverqx
|
||||
template<class Model, class Related, class PivotType>
|
||||
void BelongsToMany<Model, Related, PivotType>::attach(
|
||||
const std::map<typename BaseModel<Related>::KeyType,
|
||||
@@ -1109,7 +1109,7 @@ namespace Orm::Tiny::Relations
|
||||
if (timed)
|
||||
addTimestampsToAttachment(record);
|
||||
|
||||
// TODO pivot, withPivotValues silverqx
|
||||
// FEATURE pivot, withPivotValues silverqx
|
||||
// for (auto &[column, value] as m_pivotValues)
|
||||
// record.append(column, value);
|
||||
|
||||
@@ -1255,7 +1255,7 @@ namespace Orm::Tiny::Relations
|
||||
BelongsToMany<Model, Related, PivotType>::recordsFromIds(
|
||||
const QVector<QVariant> &ids) const
|
||||
{
|
||||
// TODO dilemma primarykey, when I solve this dilema, then add using for ModelKeyType and RelatedKeyType silverqx
|
||||
// FEATURE dilemma primarykey, when I solve this dilema, then add using for ModelKeyType and RelatedKeyType silverqx
|
||||
std::map<typename BaseModel<Related>::KeyType, QVector<AttributeItem>> records;
|
||||
|
||||
for (const auto &id : ids)
|
||||
@@ -1313,7 +1313,7 @@ namespace Orm::Tiny::Relations
|
||||
template<class Model, class Related, class PivotType>
|
||||
QString BelongsToMany<Model, Related, PivotType>::guessInverseRelation() const
|
||||
{
|
||||
// TODO relations, add parent touches (eg parentTouchesName) to the BaseModel::belongsToMany factory method silverqx
|
||||
// FEATURE relations, add parent touches (eg parentTouchesName) to the BaseModel::belongsToMany factory method silverqx
|
||||
auto relation = Utils::Type::classPureBasename<Model>();
|
||||
|
||||
relation[0] = relation[0].toLower();
|
||||
@@ -1384,7 +1384,7 @@ namespace Orm::Tiny::Relations
|
||||
{
|
||||
// Don't overwrite ID keys, throw domain exception
|
||||
if (attribute.key == m_foreignPivotKey)
|
||||
// TODO dilemma primarykey, Model::KeyType vs QVariant silverqx
|
||||
// FEATURE dilemma primarykey, Model::KeyType vs QVariant silverqx
|
||||
throwOverwritingKeyError/*<Model::KeyType>*/(attribute.key,
|
||||
this->m_parent[m_parentKey],
|
||||
attribute.value);
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace Orm::Tiny::Relations
|
||||
for (auto &model : models)
|
||||
model.template setRelation<Related>(relation, QVector<Related>());
|
||||
|
||||
// TODO add support for default models (trait SupportsDefaultModels) silverqx
|
||||
// FEATURE default models, add support for default models (trait SupportsDefaultModels) silverqx
|
||||
// model.setRelation(relation, getDefaultFor(model));
|
||||
|
||||
return models;
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Orm::Tiny::Relations
|
||||
protected:
|
||||
/*! Indicates if the ID is auto-incrementing. */
|
||||
bool u_incrementing = false;
|
||||
// TODO guarded silverqx
|
||||
// FEATURE guarded silverqx
|
||||
/*! The attributes that aren't mass assignable. */
|
||||
// QStringList u_guarded;
|
||||
};
|
||||
|
||||
@@ -671,7 +671,7 @@ namespace Relations
|
||||
return m_query->insert(attributes);
|
||||
}
|
||||
|
||||
// TODO dilemma primarykey, Model::KeyType vs QVariant silverqx
|
||||
// FEATURE dilemma primarykey, Model::KeyType vs QVariant silverqx
|
||||
template<class Model, class Related>
|
||||
quint64
|
||||
Relation<Model, Related>::insertGetId(const QVector<AttributeItem> &attributes) const
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Relations
|
||||
/*! Execute the query as a "select" statement. */
|
||||
QVector<Model> get(const QStringList &columns = {"*"});
|
||||
|
||||
// TODO dilmma primarykey, Model::KeyType for id silverqx
|
||||
// FEATURE dilemma primarykey, Model::KeyType for id silverqx
|
||||
/*! Find a model by its primary key. */
|
||||
std::optional<Model>
|
||||
find(const QVariant &id, const QStringList &columns = {"*"});
|
||||
@@ -587,7 +587,7 @@ namespace Relations
|
||||
return toBase().insert(Utils::Attribute::convertVectorToMap(attributes));
|
||||
}
|
||||
|
||||
// TODO dilemma primarykey, Model::KeyType vs QVariant silverqx
|
||||
// FEATURE dilemma primarykey, Model::KeyType vs QVariant silverqx
|
||||
template<typename Model>
|
||||
quint64
|
||||
Builder<Model>::insertGetId(const QVector<AttributeItem> &attributes) const
|
||||
@@ -1301,7 +1301,7 @@ namespace Relations
|
||||
const auto emptyConstraints = !relation.constraints;
|
||||
const auto isSelectConstraint = relation.name.contains(QChar(':'));
|
||||
|
||||
// TODO next Eager Loading Specific Columns silverqx
|
||||
// FEATURE next Eager Loading Specific Columns silverqx
|
||||
/* Select columns constraints are only allowed, when relation.constraints
|
||||
is nullptr. */
|
||||
if (isSelectConstraint)
|
||||
|
||||
@@ -65,7 +65,7 @@ void SQLiteConnector::configureForeignKeyConstraints(
|
||||
config["foreign_key_constraints"].value<bool>() ? "ON" : "OFF";
|
||||
|
||||
QSqlQuery query(connection);
|
||||
// TODO feature, schema builder, foreign key constraints silverqx
|
||||
// FEATURE schema builder, foreign key constraints silverqx
|
||||
query.prepare(QStringLiteral("PRAGMA foreign_keys = ?;"));
|
||||
query.addBindValue(foreignKeyConstraints);
|
||||
|
||||
|
||||
@@ -83,7 +83,6 @@ bool DatabaseConnection::beginTransaction()
|
||||
const auto elapsed = hitTransactionalCounters(timer);
|
||||
|
||||
#ifdef TINYORM_DEBUG_SQL
|
||||
// TODO multidriver, when will be added support for more drivers, than the Grammar will have to compile this silverqx
|
||||
/* Once we have run the transaction query we will calculate the time
|
||||
that it took to run and then log the query and execution time.
|
||||
We'll log time in milliseconds. */
|
||||
|
||||
@@ -59,7 +59,7 @@ QString Grammar::compileSelect(QueryBuilder &query) const
|
||||
QString Grammar::compileInsert(const QueryBuilder &query,
|
||||
const QVector<QVariantMap> &values) const
|
||||
{
|
||||
// TODO feature, insert with empty values, this code will never be triggered, because check in the QueryBuilder::insert, even all other code works correctly and support empty values silverqx
|
||||
// FEATURE insert with empty values, this code will never be triggered, because check in the QueryBuilder::insert, even all other code works correctly and support empty values silverqx
|
||||
if (values.isEmpty())
|
||||
return QStringLiteral("insert into %1 default values").arg(query.getFrom());
|
||||
|
||||
@@ -531,7 +531,7 @@ QString Grammar::compileDeleteWithJoins(const QueryBuilder &query, const QString
|
||||
|
||||
QString Grammar::columnize(const QStringList &columns) const
|
||||
{
|
||||
// TODO security, I'm not using wrap for columns (I'm not processing/quoting columns), Qt's mysql driver and mysql_stmt_prepare() don't quote columns, I will have to implement wrap logic for columns? silverqx
|
||||
// TODO security, I'm not using wrap for columns (I'm not processing/quoting columns), Qt's mysql driver and mysql_stmt_prepare() don't quote columns, I will have to implement wrap logic for columns, YES I DO 😈 silverqx
|
||||
// TODO docs, after investigation of 👆, write paragraph into documentation, about DB::raw() for columns, https://laravel.com/docs/8.x/queries#raw-expressions silverqx
|
||||
return joinContainer(columns, QStringLiteral(", "));
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ JoinClause &JoinClause::on(const QString &first, const QString &comparison,
|
||||
return *this;
|
||||
}
|
||||
|
||||
// TODO api different silverqx
|
||||
// NOTE api different silverqx
|
||||
JoinClause &
|
||||
JoinClause::orOn(const QString &first, const QString &comparison,
|
||||
const QString &second)
|
||||
|
||||
Reference in New Issue
Block a user