20#ifndef ORES_RISK_REPOSITORY_CURRENCY_REPOSITORY_HPP
21#define ORES_RISK_REPOSITORY_CURRENCY_REPOSITORY_HPP
25#include <sqlgen/postgres.hpp>
26#include "ores.utility/log/make_logger.hpp"
27#include "ores.database/domain/context.hpp"
28#include "ores.risk/domain/currency.hpp"
30namespace ores::risk::repository {
37 inline static std::string_view logger_name =
38 "ores.risk.repository.currency_repository";
42 static auto instance = make_logger(logger_name);
60 void write(
context ctx,
const std::vector<domain::currency>& currencies);
68 std::vector<domain::currency>
95 std::vector<domain::currency>
97 std::vector<domain::currency>
99 const std::string& iso_code);
107 std::vector<domain::currency>
Implements logging for ORE Studio.
Definition lifecycle_manager.hpp:30
Context for the operations on a postgres database.
Definition context.hpp:30
Represents a currency with its metadata and formatting rules.
Definition currency.hpp:30
Reads and writes currencies off of data storage.
Definition currency_repository.hpp:35
std::vector< domain::currency > read_all(context ctx)
Reads all currencies, possibly filtered by ISO code.
Definition currency_repository.cpp:169
std::vector< domain::currency > read_at_timepoint(context ctx, const std::string &as_of)
Reads currencies at the supplied time point, possibly filtered by ISO code.
Definition currency_repository.cpp:143
void write(context ctx, const domain::currency ¤cies)
Writes currencies to database. Expects the currency set to have unique ISO codes.
Definition currency_repository.cpp:43
std::uint32_t get_total_currency_count(context ctx)
Gets the total count of active currencies.
Definition currency_repository.cpp:115
void remove(context ctx, const std::string &iso_code)
Deletes a currency by closing its temporal validity.
Definition currency_repository.cpp:189
std::string sql()
Returns the SQL created by sqlgen to construct the table.
Definition currency_repository.cpp:38
std::vector< domain::currency > read_latest(context ctx)
Reads latest currencies, possibly filtered by ISO code.
Definition currency_repository.cpp:61