added Mass Assignment feature

- added u_fillable on models used in tests that need it
 - added documentation for mass assignment
 - added tests for mass assignment feature
 - added new Torrent models for tests, which have set up u_fillable and
   u_guarded differently
 - added schema grammar, query post-processor, and schema builder, they
   was needed for database column listing during a mass assignment
   guarded attributes check, used to check if the given attribute is
   a valid guardable column
This commit is contained in:
silverqx
2021-04-09 10:19:19 +02:00
parent 4c77f3d9b3
commit 20c03828ff
46 changed files with 1392 additions and 57 deletions
+25
View File
@@ -1,6 +1,9 @@
#include "orm/sqliteconnection.hpp"
#include "orm/query/grammars/sqlitegrammar.hpp"
#include "orm/query/processors/sqliteprocessor.hpp"
#include "orm/schema/grammars/sqlitegrammar.hpp"
#include "orm/schema/sqlitebuilder.hpp"
#ifdef TINYORM_COMMON_NAMESPACE
namespace TINYORM_COMMON_NAMESPACE
@@ -20,13 +23,35 @@ SQLiteConnection::SQLiteConnection(
of the database abstraction, so we initialize it to the default value
while starting. */
useDefaultQueryGrammar();
useDefaultPostProcessor();
}
std::unique_ptr<SchemaBuilder> SQLiteConnection::getSchemaBuilder()
{
if (!m_schemaGrammar)
useDefaultSchemaGrammar();
return std::make_unique<Schema::SQLiteBuilder>(*this);
}
std::unique_ptr<QueryGrammar> SQLiteConnection::getDefaultQueryGrammar() const
{
// FEATURE table prefix silverqx
return std::make_unique<Query::Grammars::SQLiteGrammar>();
}
std::unique_ptr<SchemaGrammar> SQLiteConnection::getDefaultSchemaGrammar() const
{
// FEATURE table prefix silverqx
return std::make_unique<Schema::Grammars::SQLiteGrammar>();
}
std::unique_ptr<QueryProcessor> SQLiteConnection::getDefaultPostProcessor() const
{
return std::make_unique<Query::Processors::SQLiteProcessor>();
}
} // namespace Orm
#ifdef TINYORM_COMMON_NAMESPACE
} // namespace TINYORM_COMMON_NAMESPACE