FlatImage
A configurable Linux containerization system
Loading...
Searching...
No Matches
db.hpp File Reference

A database that interfaces with nlohmann json. More...

#include <filesystem>
#include <fstream>
#include <nlohmann/json.hpp>
#include <variant>
#include "../std/expected.hpp"
#include "../std/concept.hpp"
#include "../macro.hpp"
Include dependency graph for db.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  ns_db::Db
 A type-safe wrapper around nlohmann::json for database operations. More...
 

Namespaces

namespace  ns_db
 JSON-based configuration database layer.
 

Concepts

concept  ns_db::anonymous_namespace{db.hpp}::IsString
 

Typedefs

using ns_db::object_t = nlohmann::basic_json<>::object_t
 
using ns_db::anonymous_namespace{db.hpp}::json_t = nlohmann::json
 
using ns_db::KeyType = json_t::value_t
 

Functions

std::ostream & ns_db::operator<< (std::ostream &os, Db const &db)
 Outputs the JSON data to an output stream.
 
Value< Dbns_db::read_file (fs::path const &path_file_db)
 Deserializes a JSON file into a Db object.
 
Value< void > ns_db::write_file (fs::path const &path_file_db, Db &db)
 Serializes a Db object and writes it to a JSON file.
 
template<ns_concept::StringRepresentable S>
Value< Dbns_db::from_string (S &&s)
 Parses a JSON string and creates a Db object.
 

Detailed Description

A database that interfaces with nlohmann json.

Author
Ruan Formigoni

Definition in file db.hpp.