2023-07-04 14:10:13 +08:00

36 lines
703 B
C++

//
// Created by dongl on 23-5-29.
//
#ifndef IM2_DB_BASE_H
#define IM2_DB_BASE_H
#include "mongocxx/pool.hpp"
#include "mongocxx/stdx.hpp"
#include "bsoncxx/stdx/optional.hpp"
#include "mongocxx/client.hpp"
using bsoncxx::builder::basic::kvp;
using bsoncxx::builder::basic::make_array;
using bsoncxx::builder::basic::make_document;
class db_base {
public:
db_base();
virtual ~db_base();
mongocxx::pool::entry acquire();
bsoncxx::stdx::optional<mongocxx::pool::entry> try_acquire();
public:
// 命中 库 表
mongocxx::collection hit_db_coll(const std::string& db_name, const std::string& coll);
protected:
mongocxx::pool* pool = nullptr;
};
#endif //IM2_DB_BASE_H