QEloquent 1.1.0
Qt most flexible ORM.
Loading...
Searching...
No Matches
QEloquent::ModelHelpers< Model, Maker > Class Template Reference

Provides static CRUD and query helpers for Model types. More...

#include <modelhelpers.h>

Static Public Member Functions

static Model make (const QJsonObject &object=QJsonObject())
 Creates a model instance with optional JSON data.
 
static QList< Modelmake (const QList< QJsonObject > &objects)
 Creates a list of model instances from a list of JSON objects.
 
static Result< Model, Errorfind (const QVariant &primary)
 Finds a model by its primary key.
 
static Result< QList< Model >, Errorfind (Query query)
 Finds models matching the given query.
 
static Result< QList< Model >, Errorpaginate (int page=1, int itemsPerPage=20, Query query=Query())
 Finds models matching the given query and limit output using pagination.
 
static Result< QList< Model >, Errorall (Query query=Query())
 Finds all models, optionaly matching the given query.
 
static Result< int, Errorcount (Query query=Query())
 Returns the number of records matching the query.
 
static Result< Model, Errorcreate (const QJsonObject &object)
 Creates and persists a new model from JSON data.
 
static Result< QList< Model >, Errorcreate (const QList< QJsonObject > &objects)
 Creates and persists multiple models from JSON data.
 
static Result< int, Errorremove (Query query)
 Deletes records matching the given query.
 
static Query query ()
 Returns a new Query object initialized for this model's table.
 
static QueryfixQuery (Query &query)
 Configures a Query object for this model's table and connection.
 
static QueryfixQuery (Query &query, const MetaObject &metaObject)
 Configures a Query object using a specific MetaObject.
 

Detailed Description

template<typename Model, typename Maker = ModelMaker<Model>>
class QEloquent::ModelHelpers< Model, Maker >

Provides static CRUD and query helpers for Model types.

This class is intended to be used via multiple inheritance in your models:

struct User : public Model, public ModelHelpers<User> { ... };
Provides static CRUD and query helpers for Model types.
Definition modelhelpers.h:57
The Model class is the base class for all ORM models.
Definition model.h:31
Template Parameters
ModelThe model type.
MakerCreation strategy (defaults to ModelMaker<Model>).

The documentation for this class was generated from the following file: