20#ifndef ORES_REFDATA_REPOSITORY_COUNTRY_REPOSITORY_HPP
21#define ORES_REFDATA_REPOSITORY_COUNTRY_REPOSITORY_HPP
25#include <sqlgen/postgres.hpp>
26#include "ores.logging/make_logger.hpp"
27#include "ores.database/domain/context.hpp"
28#include "ores.refdata/domain/country.hpp"
37 inline static std::string_view logger_name =
38 "ores.refdata.repository.country_repository";
42 static auto instance = make_logger(logger_name);
60 void write(
context ctx,
const std::vector<domain::country>& countries);
68 std::vector<domain::country>
95 std::vector<domain::country>
97 std::vector<domain::country>
99 const std::string& alpha2_code);
107 std::vector<domain::country>
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Database persistence layer for risk domain types.
Definition country_entity.hpp:28
Context for the operations on a postgres database.
Definition context.hpp:30
Represents a country using ISO 3166-1 standard codes.
Definition country.hpp:33
Reads and writes countries off of data storage.
Definition country_repository.hpp:35
std::vector< domain::country > read_at_timepoint(context ctx, const std::string &as_of)
Reads countries at the supplied time point, possibly filtered by alpha-2 code.
Definition country_repository.cpp:131
std::vector< domain::country > read_latest(context ctx)
Reads latest countries, possibly filtered by alpha-2 code.
Definition country_repository.cpp:61
void write(context ctx, const domain::country &country)
Writes countries to database. Expects the country set to have unique alpha-2 codes.
Definition country_repository.cpp:43
std::vector< domain::country > read_all(context ctx)
Reads all countries, possibly filtered by alpha-2 code.
Definition country_repository.cpp:157
std::string sql()
Returns the SQL created by sqlgen to construct the table.
Definition country_repository.cpp:38
std::uint32_t get_total_country_count(context ctx)
Gets the total count of active countries.
Definition country_repository.cpp:108
void remove(context ctx, const std::string &alpha2_code)
Deletes a country by closing its temporal validity.
Definition country_repository.cpp:177