ORE Studio 0.0.4
Loading...
Searching...
No Matches
Classes | Typedefs | Functions | Variables
ores::database::repository Namespace Reference

Repository infrastructure and bitemporal operations. More...

Classes

struct  database_info_entity
 Represents a database info in the database. More...
 
class  database_info_mapper
 Maps database_info domain entities to data storage layer and vice-versa. More...
 
class  database_info_repository
 Reads database infos from data storage. More...
 
class  repository_exception
 A fatal error has occurred whilst reading or writing to the repository. More...
 

Typedefs

using db_timestamp = ores::database::repository::db_timestamp
 Canonical database timestamp type.
 

Functions

template<typename EntityType , typename DomainType , typename QueryType , typename MapperFunc >
std::vector< DomainType > execute_read_query (context ctx, const QueryType &query, MapperFunc &&mapper, logging::logger_t &lg, const std::string &operation_desc)
 
template<typename EntityType >
void execute_write_query (context ctx, const EntityType &entity, logging::logger_t &lg, const std::string &operation_desc)
 
template<typename QueryType >
void execute_delete_query (context ctx, const QueryType &query, logging::logger_t &lg, const std::string &operation_desc)
 
std::vector< std::string > execute_raw_string_query (context ctx, const std::string &sql, logging::logger_t &lg, const std::string &operation_desc)
 
std::map< std::string, std::vector< std::string > > execute_raw_grouped_query (context ctx, const std::string &sql, logging::logger_t &lg, const std::string &operation_desc)
 
std::vector< std::vector< std::optional< std::string > > > execute_raw_multi_column_query (context ctx, const std::string &sql, logging::logger_t &lg, const std::string &operation_desc)
 
void execute_raw_command (context ctx, const std::string &sql, logging::logger_t &lg, const std::string &operation_desc)
 
std::vector< std::string > execute_parameterized_string_query (context ctx, const std::string &sql, const std::vector< std::string > &params, logging::logger_t &lg, const std::string &operation_desc)
 
std::vector< std::string > execute_parameterized_string_query (const sqlgen::postgres::Credentials &creds, const std::string &sql, const std::vector< std::string > &params, logging::logger_t &lg, const std::string &operation_desc)
 
std::vector< std::vector< std::optional< std::string > > > execute_raw_multi_column_query (const sqlgen::postgres::Credentials &creds, const std::string &sql, logging::logger_t &lg, const std::string &operation_desc)
 
void execute_parameterized_command (context ctx, const std::string &sql, const std::vector< std::string > &params, logging::logger_t &lg, const std::string &operation_desc)
 
std::vector< std::vector< std::optional< std::string > > > execute_parameterized_multi_column_query (context ctx, const std::string &sql, const std::vector< std::string > &params, logging::logger_t &lg, const std::string &operation_desc)
 
std::ostream & operator<< (std::ostream &s, const database_info_entity &v)
 
template<typename T >
void ensure_success (const T &result, logging::logger_t &lg)
 
auto make_timestamp (const std::string &s, logging::logger_t &lg)
 
template<typename EntityType >
std::string generate_create_table_sql (logging::logger_t &lg)
 
template<typename Source , typename Dest , typename MapFunc >
std::vector< Dest > map_vector (const std::vector< Source > &source, MapFunc &&map_func, logging::logger_t &lg, const std::string &log_prefix)
 
std::chrono::system_clock::time_point timestamp_to_timepoint (std::string_view timestamp_str)
 
std::chrono::system_clock::time_point timestamp_to_timepoint (const db_timestamp &ts)
 
db_timestamp timepoint_to_timestamp (const std::chrono::system_clock::time_point &tp, logging::logger_t &lg)
 

Variables

constexpr const char * MAX_TIMESTAMP = "9999-12-31 23:59:59"
 Maximum timestamp used for bitemporal records (represents "infinity").
 

Detailed Description

Repository infrastructure and bitemporal operations.

Contains shared repository infrastructure including bitemporal operations for tracking entity history with valid_from/valid_to timestamps.

Typedef Documentation

◆ db_timestamp

typedef sqlgen::Timestamp<"%Y-%m-%d %H:%M:%S"> db_timestamp

Canonical database timestamp type.

All timestamptz columns map to this type. The format matches PostgreSQL's output when the session timezone is UTC: "YYYY-MM-DD HH:MM:SS". DB sessions are forced to UTC in tenant_aware_pool::acquire() so this format is always correct regardless of the host machine timezone.

Examples
/home/runner/work/OreStudio/OreStudio/projects/ores.database/include/ores.database/repository/mapper_helpers.hpp.

Variable Documentation

◆ MAX_TIMESTAMP

constexpr const char* MAX_TIMESTAMP = "9999-12-31 23:59:59"
constexpr

Maximum timestamp used for bitemporal records (represents "infinity").

This constant is used to mark records that are currently valid (not yet ended). In bitemporal databases, a record with valid_to = MAX_TIMESTAMP indicates that the record is still current and has not been superseded or deleted.

Examples
/home/runner/work/OreStudio/OreStudio/projects/ores.database/include/ores.database/repository/helpers.hpp.