pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/BestITUserEUW/kvdb-cpp

ink crossorigen="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-9e07ff8eaaaff3a3.css" /> GitHub - BestITUserEUW/kvdb-cpp: Simple Orm Key Value Database · GitHub
Skip to content

BestITUserEUW/kvdb-cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C++ kvdb-cpp

linux windows

Orm Key Value Database

kvdb-cpp is a simple orm key value database using leveldb as db engine and reflect-cpp for providing orm support.

The following table lists the libraries in use:

Library Version License
reflect-cpp >= 0.15.0 MIT
leveldb >= 1.23 BSD-3-Clause

Supported for Types

kvdb-cpp natively supports the following types:

  • std::string
  • bool
  • integral types
  • floating types

Anything beyond that will be forwarded to reflect-cpp json serialization and deserialization which supports structs and whole bunch of other stuff check out their: C++ Standart Support

Build locally

cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCMAKE_BUILD_TYPE=Debug -Bbuild -H.
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      Only needed for clangd   
cmake --build build -j32

Ready to run Example

#include <iostream>
#include <cassert>

#include <oryx/key_value_database.hpp>

auto main() -> int {
    oryx::KeyValueDatabase db{};

    auto status = db.Open("./database.ldb");
    if (!status.ok()) {
        std::cout << "Failed to open db with error: " << status.ToString() << "\n";
        return -1;
    }

    std::string input{"SuperImportantValue"};
    status = db.Put("my_key", input);
    if (!status.ok()) {
        std::cout << "DB put failed" << "\n";
        return -1;
    }

    std::string value;
    status = db.Get("my_key", value);
    if (!status.ok()) {
        std::cout << "DB get failed" << "\n";
        return -1;
    }

    assert(input == value && "This should not happen!");
    return 0;
}

Cmake Integration

Package is being made available through the oryx namespace use this if you have it installed in your system:

find_package(kvdb-cpp REQUIRED)

target_link_libraries(your_exe oryx::kvdb-cpp)

Or with FetchContent API:

include(FetchContent)

FetchContent_Declare(
    kvdb-cpp
    GIT_REPOSITORY https://github.com/BestITUserEUW/kvdb-cpp.git
    GIT_TAG main
    OVERRIDE_FIND_PACKAGE
    EXCLUDE_FROM_ALL
)
FetchContent_MakeAvailable(oryx-crt-cpp)

find_package(kvdb-cpp REQUIRED)

target_link_libraries(my_project PUBLIC
    oryx::kvdb-cpp
)

Alternatively if you already have leveldb and reflect-cpp linking to your project you can just drop in include/key_value_database.hpp into your project.

Todo

  • Replace std::to_string() for floating point types
  • Add performance benchmarks

About

Simple Orm Key Value Database

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy