AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
ASqlModel< Model > Struct Template Reference

Defines a model that can be stored in an SQL database. Implements queries for this type to the database (insert, update, select, delete) More...

#include <AUI/Data/ASqlModel.h>

Detailed Description

template<typename Model>
struct ASqlModel< Model >
Template Parameters
ModelORM model.
Note
Model should implement AModelMeta (see AUI/Data/AModelMeta.h)

Member Function Documentation

◆ byId()

template<typename Model>
static Model ASqlModel< Model >::byId ( id_t id)
inlinestatic
Parameters
idID of the required string
Returns
the string table for the specified ID
Exceptions
NoSuchRowExceptionif no string was found for the specified ID

◆ getIdColumnNameInOtherTables()

template<typename Model>
static AString ASqlModel< Model >::getIdColumnNameInOtherTables ( )
inlinestatic
Returns
name of the relation column for other tables.

Example: struct User -> table users -> column user_id is the result.

◆ hasMany()

template<typename Model>
template<typename Other>
_< typename Other::IncompleteSelectRequest > ASqlModel< Model >::hasMany ( )
inlineprotected
User::getPosts() -> hasMany<Post>()
  |-- Post::getAuthor() -> belongsTo<Post>()
  |-- Post::getAuthor() -> belongsTo<Post>()
  |-- Post::getAuthor() -> belongsTo<Post>()
  ....
Template Parameters
OtherORM model relation will created with
Returns
incomplete SQL request (see ASqlModel::IncompleteSelectRequest)
See also
ASqlModel::IncompleteSelectRequest

◆ make()

template<typename Model>
template<typename ... Args>
static Model ASqlModel< Model >::make ( Args &&... args)
inlinestatic
Template Parameters
Argsthe types of constructor arguments
Parameters
argsthe constructor arguments
Returns
the ORM structure