13        os << ms.
a << 
" " << ms.
b;
 
 
   25        return a == other.
a && 
b == other.
b;
 
 
   30        return a < other.
a || (
a == other.
a && 
b < other.
b);
 
 
 
   39            return std::hash<int64_t>()(ms.
a) ^ std::hash<double>()(ms.
b);
 
 
 
 
   45template <
typename MapType>
 
   47    std::cout << header << std::endl;
 
   48    for (
const auto& pair : map) {
 
   49        if (!pair.second.empty()) {
 
   50            for (
const auto& item : pair.second) {
 
   51                std::cout << 
"Key: " << pair.first << 
" -> Struct: {" << item.a << 
", " << item.b << 
"}" << std::endl;
 
   54            std::cout << 
"Key: " << pair.first << 
" has an empty set." << std::endl;
 
 
   63        config.
db_path = 
"example-struct-map-set.db";  
 
   73        std::map<int, std::set<MyStruct>> map_with_set_pairs = {
 
   74            {3, {{1, 1.1}, {2, 2.2}}},
 
   79        std::cout << 
"Appending data to the database using reconcile..." << std::endl;
 
   80        key_value_db.
reconcile(map_with_set_pairs);  
 
   83        auto retrieved_map_with_set_pairs = key_value_db.
retrieve_all<std::map, std::set>();
 
   84        print_map_with_set(retrieved_map_with_set_pairs, 
"Key-value pairs in database after reconcile:");
 
   87        key_value_db.
insert(4, {3, 3.3});  
 
   88        key_value_db.
insert(4, {5, 5.5});  
 
   91        retrieved_map_with_set_pairs = key_value_db.
retrieve_all<std::map, std::set>();
 
   92        print_map_with_set(retrieved_map_with_set_pairs, 
"Key-value pairs in database after inserting new values:");
 
   95        std::cerr << 
"SQLite error: " << e.what() << std::endl;
 
   96    } 
catch (
const std::exception &e) {
 
   97        std::cerr << 
"Error: " << e.what() << std::endl;
 
 
Template class for managing key-value pairs in a SQLite database.
 
void connect()
Connects to the database using the current configuration. Initializes a connection to the database by...
 
Configuration class for SQLite database settings.
 
std::string db_path
Path to the SQLite database file.
 
Template class for managing key-value pairs in a SQLite database, where each key can map to multiple ...
 
ContainerT< KeyT, ValueT > retrieve_all(const TransactionMode &mode)
Retrieves all key-value pairs from the database with a transaction.
 
void insert(const KeyT &key, const ValueT &value, const TransactionMode &mode)
Inserts a key-value pair into the database with a transaction.
 
void clear(const TransactionMode &mode)
Clears all key-value pairs from the database with a transaction.
 
void reconcile(const ContainerT< KeyT, ValueT > &container, const TransactionMode &mode)
Reconciles the content of the container with the database with a transaction.
 
Exception class for SQLite errors.
 
void print_map_with_set(const MapType &map, const std::string &header)
 
bool operator==(const MyStruct &other) const
 
friend std::istream & operator>>(std::istream &is, MyStruct &ms)
 
bool operator<(const MyStruct &other) const
 
friend std::ostream & operator<<(std::ostream &os, const MyStruct &ms)
 
std::size_t operator()(const MyStruct &ms) const