Database System 0.1.0
Advanced C++20 Database System with Multi-Backend Support
Loading...
Searching...
No Matches
database::core Namespace Reference

Classes

class  backend_base
 CRTP template base class for database backends. More...
 
class  backend_registrar
 Helper class for automatic backend registration. More...
 
class  backend_registry
 Singleton registry for database backend plugins. More...
 
struct  connection_config
 Configuration for database connection. More...
 
class  database_backend
 Abstract base class for database backends. More...
 

Typedefs

using database_value = std::variant<std::string, int64_t, double, bool, std::nullptr_t>
 
using database_row = std::map<std::string, database_value>
 
using database_result = std::vector<database_row>
 
using backend_factory_fn = std::unique_ptr<database_backend> (*)()
 Factory function type for creating database backends.
 

Functions

std::unique_ptr< database_backendcreate_backend (const std::string &name)
 Convenience function for creating backends (static method style)
 
bool has_backend (const std::string &name)
 Convenience function for checking backend availability.
 
std::vector< std::string > available_backends ()
 Convenience function for getting available backends.
 

Typedef Documentation

◆ backend_factory_fn

using database::core::backend_factory_fn = std::unique_ptr<database_backend> (*)()

Factory function type for creating database backends.

This function signature is used by backend_registry to instantiate backends. Each backend implementation should provide a create() function matching this signature.

Returns
Unique pointer to newly created backend instance

Definition at line 307 of file database_backend.h.

◆ database_result

◆ database_row

using database::core::database_row = std::map<std::string, database_value>

Definition at line 40 of file database_backend.h.

◆ database_value

using database::core::database_value = std::variant<std::string, int64_t, double, bool, std::nullptr_t>

Function Documentation

◆ available_backends()

std::vector< std::string > database::core::available_backends ( )
inline

Convenience function for getting available backends.

Returns
Vector of registered backend names

Definition at line 247 of file backend_registry.h.

248{
249 return backend_registry::instance().available_backends();
250}

References database::core::backend_registry::available_backends(), and database::core::backend_registry::instance().

Referenced by TEST_F(), and TEST_F().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_backend()

std::unique_ptr< database_backend > database::core::create_backend ( const std::string & name)
inline

Convenience function for creating backends (static method style)

Parameters
nameBackend name
Returns
Unique pointer to backend, or nullptr if not found

This is a convenience wrapper around backend_registry::instance().create() for more concise code.

Example:

auto backend = create_backend("postgresql");
std::unique_ptr< database_backend > create_backend(const std::string &name)
Convenience function for creating backends (static method style)

Definition at line 228 of file backend_registry.h.

229{
230 return backend_registry::instance().create(name);
231}

References database::core::backend_registry::create(), and database::core::backend_registry::instance().

Referenced by TEST_F().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ has_backend()

bool database::core::has_backend ( const std::string & name)
inline

Convenience function for checking backend availability.

Parameters
nameBackend name to check
Returns
true if backend is registered

Definition at line 238 of file backend_registry.h.

239{
240 return backend_registry::instance().has_backend(name);
241}

References database::core::backend_registry::has_backend(), and database::core::backend_registry::instance().

Referenced by TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

Here is the call graph for this function:
Here is the caller graph for this function: