33 lines
675 B
C++
33 lines
675 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();
|
|
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);
|
|
|
|
private:
|
|
mongocxx::pool* pool = nullptr;
|
|
};
|
|
|
|
|
|
#endif //IM2_DB_BASE_H
|