PgStorage
C++1y Lightweight Postgres Cluster Client: sync, async, thread-safe, no dependency
Install / Use
/learn @romalin99/PgStorageREADME
QQ: 2022998727 wechart: kwg_romalin
Modern, asynchronous and synchronous, and wicked fast C++1y cluster client for Postgres-XL[Build Status] (https://C++17)
pgStorage is a C++ interface to the postgres distribute store that makes it easy to write applications that are both elegant and high-performance. Communication should be a means to an end, not something we spend a lot of time worrying about. pgStorage takes care of the details so you can move on to the interesting part of your project.
Features:
Expressive asynchronous and synchronous function, customized by return value class methods, bind expressions, or any std::function Thread-safe - use one client in multiple threads or multiple clients in one Automatic queue, even for synchronous calls from separate threads Low-level access when needed Accessible and robust error handling Configurable logging level and output to any ostream via glog to open Full SQL support for postgres-xl fixed. Fast - developed for robotics applications 100% clean Valgrind reports There is no dependency on Boost or any other libraries.
void TestTransaction() { req_t req; res_t res; req.table = "compa"; req.method = "select"; req.type=2; req.statement = R"(select * from compa limit 10)"; gPgCluser.TExec(res, req); cout<<res.result<<endl; } void TestNonTransaction() { req_t req; res_t res; req.table = "compa"; req.method = "select"; req.type=1; req.statement = R"(select * from compa limit 10)"; req.uuid=get_uuid(); gPgCluser.NTExec(res, req); cout<<res.result<<endl; }
void TestInsert() { req_t req; res_t res; req.table = "compa2"; req.method = "insert"; req.type=2; req.statement = R"(INSERT INTO compa2(NAME,AGE,ADDRESS,SALARY) VALUES('Mark', 25, 'Rich-Mond ', 65000.00 );)"; req.uuid=get_uuid(); gPgAPool.enqueue(std::unique_ptr<ComplexPostgresRequest>(new ComplexPostgresRequest(req))); } int main(int argc, char* argv[]) { TestNonTransaction(); TestTransaction(); TestInsert(); return 0; }
Contact GitHub API Training Shop Blog About
//压力测试 curl -i -X POST -H "'Content-type':'application/x-www-form-urlencoded', 'charset':'utf-8', 'Accept': 'text/plain'" -d '{"table":"companyt101","method":"select","type":2,"statement":"select * from compa;","uuid":"a3879c8e-0499-11e7-8b3e-0242ac110002"} ' 192.168.2.46:11000/v2
{ ln -sf jsondata postd ab -n 20000 -kc 500 -p postd -T 'Accept: application/json' http://192.168.2.46:11000/v2 }
./bin/Release/ethiSpark -n 1000000 -c 100 -t 5 -k http://192.168.2.46:11000/v2
