|
QEloquent 1.1.0
Qt most flexible ORM.
|
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< Model > | make (const QList< QJsonObject > &objects) |
| Creates a list of model instances from a list of JSON objects. | |
| static Result< Model, Error > | find (const QVariant &primary) |
| Finds a model by its primary key. | |
| static Result< QList< Model >, Error > | find (Query query) |
| Finds models matching the given query. | |
| static Result< QList< Model >, Error > | paginate (int page=1, int itemsPerPage=20, Query query=Query()) |
| Finds models matching the given query and limit output using pagination. | |
| static Result< QList< Model >, Error > | all (Query query=Query()) |
| Finds all models, optionaly matching the given query. | |
| static Result< int, Error > | count (Query query=Query()) |
| Returns the number of records matching the query. | |
| static Result< Model, Error > | create (const QJsonObject &object) |
| Creates and persists a new model from JSON data. | |
| static Result< QList< Model >, Error > | create (const QList< QJsonObject > &objects) |
| Creates and persists multiple models from JSON data. | |
| static Result< int, Error > | remove (Query query) |
| Deletes records matching the given query. | |
| static Query | query () |
| Returns a new Query object initialized for this model's table. | |
| static Query & | fixQuery (Query &query) |
| Configures a Query object for this model's table and connection. | |
| static Query & | fixQuery (Query &query, const MetaObject &metaObject) |
| Configures a Query object using a specific MetaObject. | |
Provides static CRUD and query helpers for Model types.
This class is intended to be used via multiple inheritance in your models:
| Model | The model type. |
| Maker | Creation strategy (defaults to ModelMaker<Model>). |