├── .DS_Store
├── .gitignore
├── CMakeLists.txt
├── LICENSE
├── README.md
├── Utils
├── CMakeLists.txt
├── NNGReq.h
├── Structs.h
├── Utils.cpp
└── Utils.h
├── conf
├── conf.toml
├── dbCommon.h
├── dbCommon.sql
├── dbTest.db
├── dbTest.h
├── dbTest.sql
├── ddl2cpp
└── main.py
├── configs
├── CMakeLists.txt
├── Configs.cpp
├── Configs.h
├── Routers.cpp
├── Routers.h
├── conf.cpp
└── conf.h
├── database
├── CMakeLists.txt
├── CommonDBProcess.cpp
├── CommonDBProcess.h
├── DBConnectManager.cpp
├── DBConnectManager.h
├── DBConnectNNG.cpp
├── DBConnectNNG.h
├── DBConnectTCP.cpp
├── DBConnectTCP.h
├── DBManager.cpp
├── DBManager.h
├── DBNNg.cpp
├── DBNNg.h
├── DBTcp.cpp
├── DBTcp.h
├── DBs.cpp
├── DBs.h
├── DealAuth.cpp
├── DealAuth.h
├── DealEcho.cpp
├── DealEcho.h
├── NNGDatabaseReq.h
├── UserManager.cpp
├── UserManager.h
├── database.cpp
└── database.h
├── db.db
├── demo
├── CMakeLists.txt
└── Source.cpp
├── endian-master.zip
├── hashlibrary
├── CMakeLists.txt
├── LICENSE
├── crc32.cpp
├── crc32.h
├── digest.cpp
├── hash.h
├── hmac.h
├── keccak.cpp
├── keccak.h
├── md5.cpp
├── md5.h
├── readme.md
├── sha1.cpp
├── sha1.h
├── sha256.cpp
├── sha256.h
├── sha3.cpp
├── sha3.h
└── tests
│ ├── github-issue2.cpp
│ ├── github-issue6.cpp
│ └── tests.cpp
├── hotupdate
├── CMakeLists.txt
├── CoEvent.cpp
├── CoEvent.h
├── FileOp.cpp
├── FileOp.h
├── FilePathMonitor.cpp
├── FilePathMonitor.h
├── IOContextManager.cpp
├── IOContextManager.h
├── PathMonitorImpl.cpp
├── PathMonitorImpl.h
├── _fileOpAsync.cpp
├── _fileOpSync.cpp
├── hotupdate.cpp
└── hotupdate.h
├── inc
├── .DS_Store
├── Apps.h
├── HttpCmdTag.h
├── MainCmdTag.h
├── TransCmdTag.h
├── boost
│ └── te.hpp
├── commUsing.h
├── consts.h
├── coros.h
├── ctml.hpp
├── enums.h
├── iguana
│ ├── detail
│ │ ├── itoa.hpp
│ │ ├── string_stream.hpp
│ │ └── traits.hpp
│ ├── json.hpp
│ ├── msgpack.hpp
│ ├── reflection.hpp
│ └── xml.hpp
├── myconcept.h
├── oneshot.hpp
├── orm
│ ├── comm_db.h
│ ├── comm_db.sql
│ ├── ddl2cpp
│ ├── demo.h
│ ├── init_db.sql
│ ├── main.py
│ ├── rest.h
│ ├── rest.sql
│ └── weixin.h
├── os
│ ├── _darwinSpec.h
│ ├── _linuxSpec.h
│ ├── _winSpec.h
│ └── os.h
├── reqreps.h
├── subprocess.h
├── templatefuncs.h
└── tsl
│ ├── array-hash
│ ├── array_growth_policy.h
│ ├── array_hash.h
│ ├── array_map.h
│ └── array_set.h
│ ├── htrie_hash.h
│ ├── htrie_map.h
│ └── htrie_set.h
├── logo.png
├── networkinterface
├── CMakeLists.txt
├── ChannelCombine.h
├── ChannelManager.cpp
├── ChannelManager.h
├── ChannelsMgr.cpp
├── ChannelsMgr.h
├── FullDuplexChannel.cpp
├── FullDuplexChannel.h
├── FullDuplexChannelManager.h
├── Https.cpp
├── Https.h
├── LocalNetChannel.cpp
├── LocalNetChannel.h
├── LocalNetManager.cpp
├── LocalNetManager.h
├── MainPlatformDealer.cpp
├── MainPlatformDealer.h
├── MesageHandlerBase.cpp
├── MesageHandlerBase.h
├── MessageRouter.cpp
├── MessageRouter.h
├── MessageSplitFuncs.cpp
├── MessageSplitFuncs.h
├── NMessage.cpp
├── NMessage.h
├── PackDealerBase.h
├── PackDealerCommon.cpp
├── PackDealerCommon.h
├── PackDealerMainSub.cpp
├── PackDealerMainSub.h
├── PackDealerNoHead.cpp
├── PackDealerNoHead.h
├── PackDealerNoMain.cpp
├── PackDealerNoMain.h
├── PackUnpack.cpp
├── PackUnpack.h
├── PackUnpackManager.cpp
├── PackUnpackManager.h
├── PlatformPackInterface.h
├── ReadMe.txt
├── ServerBase.h
├── ServerCommon.cpp
├── ServerCommon.h
├── StreamHandler.h
├── StreamNetDealer.cpp
├── StreamNetDealer.h
├── dealers
│ ├── MainAssPlatPack.cpp
│ ├── MainAssPlatPack.h
│ ├── NoMainAssPlatPack.cpp
│ └── NoMainAssPlatPack.h
├── networkinterface.cpp
├── networkinterface.h
├── nngs
│ ├── AsynBase.h
│ ├── AsynRep.cpp
│ ├── AsynRep.h
│ ├── AsynRepImpl.cpp
│ ├── AsynRepImpl.h
│ ├── AsynReq.cpp
│ ├── AsynReq.h
│ ├── AsynReqImpl.cpp
│ ├── AsynReqImpl.h
│ ├── NNGCommBase.h
│ ├── NngRep.h
│ ├── NngReq.h
│ ├── NngServerBase.h
│ ├── RepManager.h
│ ├── ReqImpl.cpp
│ ├── ReqImpl.h
│ ├── ReqManager.h
│ ├── ReqRepRaw.cpp
│ ├── ReqRepRaw.h
│ ├── SyncRep2.h
│ ├── SyncReq.cpp
│ └── SyncReq.h
├── socket
│ ├── TcpChannel.h
│ ├── TcpChannelImp.h
│ ├── TcpChannelImpl.cpp
│ ├── TcpClient.h
│ ├── TcpClientCombine.h
│ ├── TcpServer.h
│ ├── TcpServerCombine.h
│ ├── TcpStreamHandler.cpp
│ └── TcpStreamHandler.h
└── wss.h
├── rayX
├── CMakeLists.txt
├── ray
│ ├── api.h
│ └── api
│ │ ├── actor_creator.h
│ │ ├── actor_handle.h
│ │ ├── actor_task_caller.h
│ │ ├── arguments.h
│ │ ├── common_types.h
│ │ ├── function_manager.h
│ │ ├── internal_api.h
│ │ ├── logging.h
│ │ ├── object_ref.h
│ │ ├── overload.h
│ │ ├── ray_config.h
│ │ ├── ray_exception.h
│ │ ├── ray_remote.h
│ │ ├── ray_runtime.h
│ │ ├── ray_runtime_holder.h
│ │ ├── runtime_env.h
│ │ ├── serializer.h
│ │ ├── static_check.h
│ │ ├── task_caller.h
│ │ ├── task_options.h
│ │ ├── type_traits.h
│ │ ├── wait_result.h
│ │ └── xlang_function.h
├── rayx.cpp
└── rayx.h
├── tests
├── CMakeLists.txt
├── asyncEvent
│ ├── CMakeLists.txt
│ └── Common.cpp
├── asyncStreamtest
│ ├── CMakeLists.txt
│ ├── Common.cpp
│ ├── linux
│ │ └── typecheck.cpp
│ └── win
│ │ └── winspec.cpp
├── envcheck
│ ├── CMakeLists.txt
│ ├── Common.cpp
│ ├── linux
│ │ └── typecheck.cpp
│ └── win
│ │ └── typecheck.cpp
├── networktest
│ ├── CMakeLists.txt
│ ├── Common.cpp
│ ├── linux
│ │ └── typecheck.cpp
│ └── win
│ │ └── winspec.cpp
├── rayXtest
│ ├── CMakeLists.txt
│ ├── Common.cpp
│ ├── linux
│ │ └── typecheck.cpp
│ └── win
│ │ └── typecheck.cpp
└── sqlppTest
│ ├── CMakeLists.txt
│ └── Common.cpp
├── tzdata2022a.tar.gz
├── uSockets2
├── CMakeLists.txt
├── src
│ ├── .DS_Store
│ ├── bsd.c
│ ├── context.c
│ ├── crypto
│ │ ├── openssl.c
│ │ ├── sni_tree.cpp
│ │ └── wolfssl.c
│ ├── eventing
│ │ ├── asio.cpp
│ │ ├── epoll_kqueue.c
│ │ ├── gcd.c
│ │ └── libuv.c
│ ├── internal
│ │ ├── eventing
│ │ │ ├── asio.h
│ │ │ ├── epoll_kqueue.h
│ │ │ ├── gcd.h
│ │ │ └── libuv.h
│ │ ├── internal.h
│ │ ├── loop_data.h
│ │ └── networking
│ │ │ └── bsd.h
│ ├── libusockets.h
│ ├── loop.c
│ ├── quic.c
│ ├── quic.h
│ ├── socket.c
│ └── udp.c
├── uSockets-0.8.2.zip
└── uSockets-0.8.3.zip
└── whereami
├── .gitattributes
├── .gitignore
├── CMakeLists.txt
├── LICENSE.MIT
├── LICENSE.WTFPLv2
├── README.md
├── _gnu-make
└── Makefile
├── _ios-xcode
├── .gitignore
├── WhereAmI-Info.plist
└── WhereAmI.xcodeproj
│ ├── project.pbxproj
│ └── project.xcworkspace
│ └── contents.xcworkspacedata
├── _mac-xcode
├── .gitignore
└── WhereAmI.xcodeproj
│ ├── project.pbxproj
│ └── project.xcworkspace
│ └── contents.xcworkspacedata
├── example
├── executable.c
└── library.c
└── src
├── whereami.c
└── whereami.h
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yangxingpping/SM/b9cb6b12ab26a4601d24aa406f349c1eda36b38b/.DS_Store
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | build*/
2 | external/*
3 | !external/CMakeLists.txt
4 | *.sublime-workspace
5 | .tags
6 | tags
7 | *.pyc
8 | *.swp
9 | *.swo
10 |
11 | system.txt
12 |
13 | *.log
14 | /.vscode/
15 | /source/.vscode/
16 |
17 | /source/inc/export_flags/
18 |
19 | /inc/export_flags/
20 | /inc/Windows/
21 | /inc/Linux/
22 | /inc/os/Windows/
23 | /inc/os/Linux/
24 | /inc/os/Darwin/
25 | /inc/Darwin/
26 | /win_build/
27 | /.vs/
28 |
29 | endian/
30 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 alqaz
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # SM
2 |
3 |
4 |
5 | 格式化输出 fmt
6 |
7 | 日志 spdlog
8 |
9 | 关系数据库连接 sqlpp11
10 |
11 | tcp/udp(uSockets,libuv)
12 |
13 | http(uWebSockets)
14 |
15 | 协程,磁盘文件异步访问(asio)
16 |
17 | 强扩展的消息协议(nanomsg)
18 |
19 | 任务调度库(taskflow)支持cpu和GPU
20 |
21 | 无锁队列(concurrentqueue)
22 |
23 | 枚举类型反射(magic_enum)
24 |
25 | 序列化json(nlohmann-json)
26 |
27 | 磁盘文件更新检测库(efsw)
28 |
29 | python交互(pybind11)
30 |
31 | 以及其他一些周边的库(jwt-cpp,cppcodec等)
32 |
33 | 编译工具(cmake(3.20之后版本),方便和vcpkg配合使用,后续加入windows,deb,rpm安装包打包脚本(cpack))
34 |
35 | 包管理工具(vcpkg)
36 |
37 | 未开始模块:
38 |
39 | 分布式执行运行时(Ray,分布式调用直接简化成C++的函数和类,使用非常简单)
40 |
41 | rpc(rpclib)
42 |
43 | 通用框架SM(Suture monster 名字本身是缝合),中文名:百家衣
44 |
45 |

46 | 中途遇到比较困难的问题会在 https://github.com/yangxingpping/crashDay.git 记录
47 |
48 |
--------------------------------------------------------------------------------
/Utils/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | PROJECT(Utils)
3 |
4 | set(CMAKE_CXX_STANDARD 20)
5 |
6 | FILE(GLOB_RECURSE MY_HEADERS "./*.h")
7 | source_group("Headers" FILES ${MY_HEADERS})
8 |
9 | FILE(GLOB_RECURSE MY_INTERFACEHEADERS "../inc/networks/*.h")
10 | source_group("Headers" FILES ${MY_INTERFACEHEADERS})
11 |
12 | add_definitions(-DBUILD_SHARED_LIBS -DUtils_EXPORTS)
13 |
14 | include_directories(../inc)
15 |
16 | AUX_SOURCE_DIRECTORY(. A)
17 |
18 | IF(CMAKE_SYSTEM_NAME MATCHES "Windows")
19 | link_libraries(Ws2_32)
20 | add_compile_options(/Zc:__cplusplus /Wv:19.27)
21 | ADD_LIBRARY(Utils SHARED ${A})
22 | set_target_properties(Utils PROPERTIES VS_GLOBAL_VcpkgEnabled true)
23 | ELSE()
24 | ADD_LIBRARY(Utils ${A})
25 | ENDIF(CMAKE_SYSTEM_NAME MATCHES "Windows")
26 |
27 | include(GenerateExportHeader)
28 | generate_export_header(Utils EXPORT_FILE_NAME ${CMAKE_CURRENT_SOURCE_DIR}/../inc/os/${CMAKE_SYSTEM_NAME}/export_flags/${PROJECT_NAME}Export.h)
29 |
30 | target_include_directories(
31 | Utils SYSTEM
32 | PUBLIC
33 | "$
"
34 | )
35 |
36 | target_link_libraries(Utils PRIVATE spdlog::spdlog PRIVATE date::date date::date-tz PRIVATE msgpack-c)
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/Utils/NNGReq.h:
--------------------------------------------------------------------------------
1 |
2 | #pragma once
3 |
4 | #include "reqs.h"
5 | #include "Utils.h"
6 | #include "spdlog/spdlog.h"
7 | #include "magic_enum.hpp"
8 | #include
9 | #include
10 | #include
11 | #include "nng/nng.h"
12 | #include "nng/protocol/reqrep0/req.h"
13 |
14 | using std::string;
15 | using std::string_view;
16 |
17 | namespace SMUtils
18 | {
19 | class NNGReq
20 | {
21 | public:
22 | NNGReq(string ip, uint16_t port, MainCmd mainx, ChannelType ct)
23 | : _ip(ip)
24 | , _port(port)
25 | , _mainc(mainx)
26 | , _channelType(ct)
27 | {
28 | string addr = "tcp://";
29 | addr += _ip;
30 | addr += ":";
31 | addr += std::to_string(_port);
32 | int opnng = nng_req0_open(&_sock);
33 | opnng = nng_dialer_create(&_dailer, _sock, addr.c_str());
34 | nng_dialer_start(_dailer, NNG_FLAG_NONBLOCK);
35 | SPDLOG_INFO("start nng request channel type {} main type {} on addr {}",
36 | magic_enum::enum_name(_channelType), magic_enum::enum_name(mainx), addr);
37 | }
38 | ~NNGReq()
39 | {
40 | nng_close(_sock);
41 | }
42 | template
43 | Rep sendReq(Req& req, AssType op)
44 | {
45 | int nnop = 0;
46 | Rep rep;
47 | string strreq = req.to_string();
48 | auto reqhead = SMUtils::packcmdrep(_mainc, (short)(op) , strreq.length());
49 | string packreq(reqhead.begin(), reqhead.end());
50 | packreq += strreq;
51 | nnop = nng_send(_sock, &packreq[0], packreq.length(), 0);
52 | size_t recvlen = 0;
53 | char* recvbuf = NULL;
54 | nnop = nng_recv(_sock, &recvbuf, &recvlen, NNG_FLAG_ALLOC);
55 | auto header = parsecmd(string_view(recvbuf, 12));
56 | string strbody{recvbuf+12, recvlen-12};
57 | rep.parse(strbody);
58 | return rep;
59 | }
60 | nng_socket _sock;
61 | nng_dialer _dailer;
62 | string _ip;
63 | uint16_t _port;
64 |
65 | MainCmd _mainc;
66 | ChannelType _channelType;
67 | };
68 | }
69 |
70 |
71 | //NNGDBReq
72 |
--------------------------------------------------------------------------------
/conf/conf.toml:
--------------------------------------------------------------------------------
1 | #context const, current text should not be modified
2 | [log]
3 | [log.node]
4 | addr = "127.0.0.1"
5 | port = 8010
6 | [log.context]
7 | log_level_array = ["trace", "debug", "info", "warn", "error"]
8 | format = "[%H:%M:%S %z] [%n] [%^%L%$] [%!] [thread %t] %v"
9 | level = 1 # "debug"
10 | log_file = "server.log"
11 | log_file_path= "./"
12 | log_roll_size = 10000000
13 |
14 | [login]
15 | port = 10086
16 | tokenlife = 3600
17 | [guid]
18 | [guid.node]
19 | addr = "127.0.0.1"
20 | port = 8081
21 |
22 | [http]
23 | addr="127.0.0.1"
24 | port=10086
25 | rootPath="./dist"
26 | resRootPath="./dist"
27 |
28 | [jwt]
29 | issuer="alqaz"
30 | type="JWS"
31 | key="key"
32 | noAuthUrl=["/http/User/Regist"]
33 |
34 |
35 |
36 | [transport]
37 | addr="127.0.0.1"
38 | port=10087
39 | timeout=3600
40 |
41 | [nanomsg]
42 | [nanomsg.rep]
43 | addr="127.0.0.1"
44 | port=9001
45 |
46 | [dbmgr]
47 | databasetype=1 #0 postgresql; 1 sqlite3
48 | databasemodel=0 #embed; 1 alone
49 | databasedebug=true #true or false
50 | [dbmgr.sqlite]
51 | sqlitepath="conf"
52 | sqlitename = "db.db"
53 | [dbmgr.postgresql]
54 | dbname="demo"
55 | addr="127.0.0.1"
56 | port=5432
57 | user="postgres"
58 | pass="123456"
59 | useSSL=0
60 | [dbmgr.redis]
61 | addr="127.0.0.1"
62 | port=6379
63 | user=""
64 | pass=""
65 | useSSL=0
66 | [dbmgr.remote]
67 | addr="127.0.0.1"
68 | port=5400
69 | useSSL=0
70 | [dbmgr.remotenng]
71 | addr="127.0.0.1"
72 | port=5401
73 | useSSL=0
74 | [dbmgr.rremote]
75 | addr="127.0.0.1"
76 | port=5402
77 | useSSL=0
78 | [dbmgr.rremotenng]
79 | addr="127.0.0.1"
80 | port=5403
81 | useSSL=0
--------------------------------------------------------------------------------
/conf/dbCommon.sql:
--------------------------------------------------------------------------------
1 |
2 | DROP table if EXISTS users;
3 | DROP table if EXISTS token;
4 | DROP table if EXISTS sysadmin;
5 |
6 | create table users(name varchar(255), passwd varchar(255), phone varchar(64), expiredate datetime);
7 | create table token(name varchar(255), token varchar(255));
8 | create table sysadmin(user varchar(255), phone varchar(255), admin varchar(255), role int);
--------------------------------------------------------------------------------
/conf/dbTest.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yangxingpping/SM/b9cb6b12ab26a4601d24aa406f349c1eda36b38b/conf/dbTest.db
--------------------------------------------------------------------------------
/conf/dbTest.h:
--------------------------------------------------------------------------------
1 | // generated by ./ddl2cpp ./dbTest.sql dbTest dbTest
2 | #ifndef DBTEST_DBTEST_H
3 | #define DBTEST_DBTEST_H
4 |
5 | #include
6 | #include
7 | #include
8 |
9 | namespace dbTest
10 | {
11 | namespace Forsumgroup_
12 | {
13 | struct Name
14 | {
15 | struct _alias_t
16 | {
17 | static constexpr const char _literal[] = "name";
18 | using _name_t = sqlpp::make_char_sequence;
19 | template
20 | struct _member_t
21 | {
22 | T name;
23 | T& operator()() { return name; }
24 | const T& operator()() const { return name; }
25 | };
26 | };
27 | using _traits = sqlpp::make_traits;
28 | };
29 | struct Ed
30 | {
31 | struct _alias_t
32 | {
33 | static constexpr const char _literal[] = "ed";
34 | using _name_t = sqlpp::make_char_sequence;
35 | template
36 | struct _member_t
37 | {
38 | T ed;
39 | T& operator()() { return ed; }
40 | const T& operator()() const { return ed; }
41 | };
42 | };
43 | using _traits = sqlpp::make_traits;
44 | };
45 | struct Price
46 | {
47 | struct _alias_t
48 | {
49 | static constexpr const char _literal[] = "price";
50 | using _name_t = sqlpp::make_char_sequence;
51 | template
52 | struct _member_t
53 | {
54 | T price;
55 | T& operator()() { return price; }
56 | const T& operator()() const { return price; }
57 | };
58 | };
59 | using _traits = sqlpp::make_traits;
60 | };
61 | } // namespace Forsumgroup_
62 |
63 | struct Forsumgroup: sqlpp::table_t
67 | {
68 | struct _alias_t
69 | {
70 | static constexpr const char _literal[] = "forsumgroup";
71 | using _name_t = sqlpp::make_char_sequence;
72 | template
73 | struct _member_t
74 | {
75 | T forsumgroup;
76 | T& operator()() { return forsumgroup; }
77 | const T& operator()() const { return forsumgroup; }
78 | };
79 | };
80 | };
81 | } // namespace dbTest
82 | #endif
83 |
--------------------------------------------------------------------------------
/conf/dbTest.sql:
--------------------------------------------------------------------------------
1 |
2 | DROP table if EXISTS forsumgroup;
3 |
4 | create table forsumgroup(name varchar(255), ed datetime, price int);
5 |
6 | insert into forsumgroup values("alqaz", "2022/01/01", 1);
7 | insert into forsumgroup values("xyz", "2022/01/01", 2);
8 | insert into forsumgroup values("alqaz", "2022/01/02", 3);
9 | insert into forsumgroup values("xyz", "2022/01/02", 4);
10 |
--------------------------------------------------------------------------------
/conf/main.py:
--------------------------------------------------------------------------------
1 | #
2 | #script for generate database and database tables
3 |
4 | import os;
5 |
6 | #not support recursive
7 | if __name__ == '__main__':
8 | for root, dirs, files in os.walk('./'):
9 | for file in files:
10 | curfile = os.path.join(root, file);
11 | nameArr = os.path.splitext(file);
12 | if curfile.endswith('.sql') == False:
13 | continue;
14 | os.system('python3 ./ddl2cpp {} {} {}'.format(curfile, nameArr[0], nameArr[0]));
15 |
--------------------------------------------------------------------------------
/configs/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | PROJECT(configs)
3 |
4 | set(CMAKE_CXX_STANDARD 20)
5 |
6 | FILE(GLOB_RECURSE MY_HEADERS "./*.h")
7 | source_group("Headers" FILES ${MY_HEADERS})
8 |
9 | FILE(GLOB_RECURSE MY_INTERFACEHEADERS "../inc/networks/*.h")
10 | source_group("Headers" FILES ${MY_INTERFACEHEADERS})
11 |
12 | add_definitions(-DBUILD_SHARED_LIBS -Dconfigs_EXPORTS)
13 |
14 | include_directories(../inc ../Utils)
15 |
16 | AUX_SOURCE_DIRECTORY(. A)
17 |
18 | IF(CMAKE_SYSTEM_NAME MATCHES "Windows")
19 | link_libraries(Ws2_32)
20 | add_compile_options(/Zc:__cplusplus /Wv:19.27)
21 | ADD_LIBRARY(configs SHARED ${A})
22 | set_target_properties(configs PROPERTIES VS_GLOBAL_VcpkgEnabled true)
23 | ELSE()
24 | ADD_LIBRARY(configs ${A})
25 | ENDIF(CMAKE_SYSTEM_NAME MATCHES "Windows")
26 |
27 |
28 |
29 |
30 |
31 | include(GenerateExportHeader)
32 | generate_export_header(configs EXPORT_FILE_NAME ${CMAKE_CURRENT_SOURCE_DIR}/../inc/os/${CMAKE_SYSTEM_NAME}/export_flags/${PROJECT_NAME}Export.h)
33 |
34 | target_include_directories(
35 | configs SYSTEM
36 | PUBLIC
37 | "$"
38 | )
39 |
40 |
41 |
42 | target_link_libraries(configs PRIVATE whereami PRIVATE toml11::toml11 PRIVATE Utils PRIVATE spdlog::spdlog )
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/configs/Configs.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "configsExport.h"
4 |
5 | #include "Structs.h"
6 |
7 |
8 |
9 | namespace SMCONF
10 | {
11 |
12 | CONFIGS_EXPORT bool SInitLog(string logfile, string loggername);
13 | CONFIGS_EXPORT bool SInitLog();
14 | class CONFIGS_EXPORT Configs
15 | {
16 | public:
17 | static bool sInit();
18 | static Configs& getInst2();
19 | Configs();
20 | ~Configs();
21 | bool Parse(string path);
22 | DatabaseConfig& getDBConfig();
23 | void setDBConfig(const DatabaseConfig& conf);
24 | HttpConfig& getHttpConfig();
25 | LogConfig& getLogConfig();
26 | TransportConfig& getTransportConfig();
27 | NanoRepConf& getNngRepConfig();
28 | JWTConf& getJWTConf();
29 | TimeZoneConfig& getTimeZoneConfig();
30 | bool isRouterNeedJwt(string_view url);
31 |
32 | //protected:
33 |
34 | //private:
35 | NanoRepConf _nanotcp;
36 | DatabaseConfig _dbconf;
37 | HttpConfig _http;
38 | LogConfig _log;
39 | TransportConfig _transport;
40 | JWTConf _jwt;
41 | string _path;
42 | TimeZoneConfig _tzconf;
43 | };
44 | }
45 |
46 | #define CONFINST (SMCONF::Configs::getInst2())
47 |
--------------------------------------------------------------------------------
/configs/Routers.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "configsExport.h"
3 | #include "magic_enum.hpp"
4 | #include "templatefuncs.h"
5 | #include "asio/awaitable.hpp"
6 | #include "fmt/format.h"
7 | #include "Utils.h"
8 | #include "tsl/htrie_map.h"
9 | #include