提交 68a1db0c authored 作者: blu's avatar blu

init

上级 037f2843
#include "inc/database.h"
#include "spdlog/spdlog.h"
int main(){
int ret;
json j, p;
// case table info
spdlog::set_level(spdlog::level::debug);
ret = DB::clearTable("info", "aa.db");
spdlog::info("ret: {}", ret);
ret = DB::clearTable("info", "a.db");
spdlog::info("ret: {}", ret);
ret = DB::setInfo(&p, "a.db");
spdlog::info("ret: {}", ret);
j["sn"] = "sn-aa";
j["lastboot"] = "2019-04-25 10:10:10";
ret = DB::setInfo(&j, "a.db");
spdlog::info("ret: {}", ret);
ret = DB::getInfo(&j, -1, "a.db");
spdlog::info("ret: {}", ret);
j["sn"] = "sn-aa";
j["lastboot"] = "2019-04-25 10:10:17";
ret = DB::setInfo(&j, "a.db");
spdlog::info("ret: {}", ret);
ret = DB::getInfo(&j, -1, "a.db");
spdlog::info("ret: {}", ret);
j["sn"] = "sn-ab";
j["lastboot"] = "2019-04-25 10:10:17";
ret = DB::setInfo(&j, "a.db");
spdlog::info("ret: {}", ret);
ret = DB::getInfo(&p, -1, "a.db");
spdlog::info("ret: {}", ret);
p.clear();
ret = DB::getInfo(&p, 0, "a.db");
spdlog::info("ret: {}", ret);
p.clear();
ret = DB::getInfo(&p, 1, "a.db");
spdlog::info("ret: {}", ret);
// case table modules
return 0;
}
\ No newline at end of file
#include "inc/json.hpp"
#include <iostream>
using namespace nlohmann;
using namespace std;
int main() {
json origin = R"({"name": "john", "genda":"male"})"_json;
json newJ = R"({"name":"Jim", "age":10})"_json;
json diff = json::diff(origin, newJ);
cout << diff.dump();
}
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论