ORM C++
Loading...
Searching...
No Matches
orm::Database< SchemaType > Class Template Referencefinal

Database facade bound to one closed compile-time model schema. More...

#include <database.hpp>

Inheritance diagram for orm::Database< SchemaType >:
Collaboration diagram for orm::Database< SchemaType >:

Public Types

template<typename T>
using Payload = db::binding::BindingPayload<T, SchemaType>
template<typename T>
using ProjectionPayload = db::binding::ProjectionPayload<T>

Public Member Functions

template<typename T>
auto select (Query< T > &query) -> std::vector< T >
template<typename Source, typename Result>
auto select (ProjectionQuery< Source, Result > &query) -> std::vector< Result >
template<typename T>
auto insert (const std::vector< T > &objects) -> void
template<typename T>
auto insert (T object) -> void
template<typename T>
auto update (const Update< T > &update) -> std::size_t
template<typename T>
auto remove (const query::Predicate &predicate) -> std::size_t
template<typename T>
auto createTable () -> void
template<typename T>
auto deleteTable () -> void
template<typename T>
auto createRelationTables () -> void
template<typename T>
auto deleteRelationTables () -> void
template<typename Owner, typename Target>
auto link (const Owner &owner, std::string_view relationField, const Target &target) -> std::size_t
template<typename Owner, typename Target>
auto unlink (const Owner &owner, std::string_view relationField, const Target &target) -> std::size_t
 DatabaseCore ()
 Constructs a new Database object.
 DatabaseCore (db::CommandGeneratorFactory factory)
 Constructs a database with an application-supplied backend registry.
 DatabaseCore (const DatabaseCore &)=delete
 DatabaseCore (DatabaseCore &&)=delete
Public Member Functions inherited from orm::DatabaseCore
 DatabaseCore ()
 Constructs a new Database object.
 DatabaseCore (db::CommandGeneratorFactory factory)
 Constructs a database with an application-supplied backend registry.
 DatabaseCore (const DatabaseCore &)=delete
 DatabaseCore (DatabaseCore &&)=delete
auto operator= (const DatabaseCore &) -> DatabaseCore &=delete
auto operator= (DatabaseCore &&) -> DatabaseCore &=delete
auto connect (const std::string &connectionString) -> void
 Connects to a database.
auto connect (db::BackendType requestedBackend, const std::string &connectionString) -> void
 Connects using an explicitly selected registered backend.
auto disconnect () -> void
 Disconnects from the database.
auto getBackendType () const noexcept -> db::BackendType
 Get the backend type of the database.
auto isConnected () const noexcept -> bool
 Returns whether a backend session is currently open.
auto getBackendCapabilities () const -> const db::BackendCapabilities &
 Returns the capabilities advertised by the connected backend.
auto beginTransaction () -> void
 Starts a transaction.
auto commitTransaction () -> void
 Commits a transaction.
auto rollbackTransaction () -> void
 Rollbacks a transaction.

Additional Inherited Members

Protected Member Functions inherited from orm::DatabaseCore
template<typename SchemaType, typename T>
auto selectImpl (Query< T > &query) -> std::vector< T >
 Executes a select query and returns the result.
template<typename SchemaType, typename Source, typename Result>
auto selectImpl (ProjectionQuery< Source, Result > &query) -> std::vector< Result >
 Executes a projection select query and returns DTO results.
template<typename SchemaType, typename T>
auto insertImpl (const std::vector< T > &objects) -> void
 Executes a insert query for multiple objects.
template<typename SchemaType, typename T>
auto insertImpl (T object) -> void
 Executes a insert query for a single object.
template<typename SchemaType, typename T>
auto updateImpl (const Update< T > &update) -> std::size_t
 Executes an update query.
template<typename SchemaType, typename T>
auto removeImpl (const query::Predicate &predicate) -> std::size_t
 Executes a delete query for rows matching a predicate.
template<typename SchemaType, typename T>
auto createTableImpl () -> void
 Execute a create table query for a model.
template<typename SchemaType, typename T>
auto deleteTableImpl () -> void
 Execute a delete table query for a model.
template<typename SchemaType, typename T>
auto createRelationTablesImpl () -> void
 Creates junction tables owned by a model's ManyToMany mappings.
template<typename SchemaType, typename T>
auto deleteRelationTablesImpl () -> void
 Drops junction tables owned by a model's ManyToMany mappings.
template<typename SchemaType, typename Owner, typename Target>
auto linkImpl (const Owner &owner, std::string_view relationField, const Target &target) -> std::size_t
 Creates or changes a OneToMany/ManyToMany association.
template<typename SchemaType, typename Owner, typename Target>
auto unlinkImpl (const Owner &owner, std::string_view relationField, const Target &target) -> std::size_t
 Removes a OneToMany/ManyToMany association.

Detailed Description

template<typename SchemaType>
class orm::Database< SchemaType >

Database facade bound to one closed compile-time model schema.

Backend selection and connection state remain runtime concerns. Every model operation is checked against SchemaType before the implementation is

instantiated.


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