diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-27 19:33:45 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-27 19:33:45 +0100 |
commit | b2fc208fbdb55ecc3cba59e2dd51976ce829a4be (patch) | |
tree | 1a60e74b7533403831868b04943978987cec2c75 /src/example/db.cpp | |
parent | ecc5761fa78ccb57db958467c3fc999aceadd409 (diff) |
WIP db facade
Diffstat (limited to 'src/example/db.cpp')
-rw-r--r-- | src/example/db.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/example/db.cpp b/src/example/db.cpp new file mode 100644 index 0000000..b1ab196 --- /dev/null +++ b/src/example/db.cpp @@ -0,0 +1,30 @@ +#include <crepe/DB.h> +#include <crepe/api/Config.h> +#include <crepe/util/log.h> + +using namespace crepe; +using namespace std; + +// run before main +static auto _ = [] () { + auto & cfg = api::Config::get_instance(); + cfg.log.level = util::LogLevel::TRACE; + return 0; +}(); + +int main() { + dbg_trace(); + + DB db("file.db"); + + const char * test_key = "test-key"; + string test_data = "Hello world!"; + + dbg_logf("DB has key = %d", db.has(test_key)); + + db.set(test_key, test_data); + + dbg_logf("key = \"%s\"", db.get(test_key).c_str()); + + return 0; +} |