C++ Web 框架 paozhu 1.3.0发布

155 阅读2分钟

c++ 快速开发 web 框架 经过实际项目开发,根据反馈和修复, 已经发布 1.3.0 版

paozhu 框架 集成 ORM HTTP/2 功能,压力测试可以平稳运行。

github.com/hggq/paozhu

1.3.0 版更新内容

新版添加了 结构体或类对象 json_encode json_decode 功能

支持结构体嵌套和组合使用,可以反射输出 JSON 或 把 JSON 解析到对象

比如如下结构体  

namespace psy
{

//@reflect json to_json from_json
struct department_outjson_t
{

    unsigned int id = 0;

    unsigned int key = 0;

    unsigned int value = 0;

    unsigned int parentid = 0;

    unsigned int bianzhi_num = 0;

    bool isopen = true;

    bool _is_use = false;

    std::string title;

    std::string desc;

    std::vector<department_outjson_t> children;

    std::string to_json(std::string aa="",int offset=0);

    unsigned int from_json()
    {
        //**aaaaa
        /*
        aaaa [][}]
        */
        char b='}';
        if(b=='{')
        {
        std::cout<<"assss}sss}{ssss}sss}"<<std::endl;
        }
    return 0;
    }
};

 

//@reflect json to_json from_json
struct department_listoutjson_t
{
    unsigned int code=0;
    struct department_tables
    {
        std::vector<department_outjson_t> list;
        unsigned int total=0;
    } data;

std::vector<std::vector<std::string>> names;
};

} // namespace psy

使用方式


  psy::department_listoutjson_t depout_data;

  depout_data.code = 0;
  depout_data.data.total = 0;

  std::string jsondep_str = psy::json_encode(depout_data);

  psy::department_listoutjson_t new_depout_data;
  psy::json_decode(new_depout_data, jsondep_str);
 
  std::string jsondep_str_temp = psy::json_encode(new_depout_data);

paozhu框架特性

✅ 1. 自带json编解码不用第三方库,标准json支持
✅ 2. 支持多域名网站
✅ 3. 支持多域名ssl 服务端
✅ 4. 支持http/1.1、http/2协议
✅ 5. 支持websocket服务端
✅ 6. 框架自带websocket推送,支持定时推送到webscoket客户端
✅ 7. 支持同步httpclient get post
✅ 8. 框架自带ORM,使用链接池方式,目前支持mysql
✅ 9. 框架自带线程池,和用户代码运行的线程池
✅10. 框架使用asio自带的协程
✅11. 框架特色是I/O 使用协程池 用户代码运行使用线程池,类似GO那种调度,只是针对http请求调度
✅12. 框架支持普通文件gzip、br,并支持缓存到磁盘,下次不用cpu再压缩
✅13. 框架解析URL和POST,解析结果类似PHP GET POST方式获取内容
✅14. 自带sendmail类库
✅15. 生成二维码(qrcode),需要gd、qrencode库
✅16. 插件化编程,热动态更新,使用动态库方式
✅17. 框架内置通用数据缓存模块,ORM结果缓存,提高并发能力
✅18. 框架controller目录注解功能,方便添加URL路由映射,降低入门心智
✅19. 结构和类注解JSON功能,使用json_encode json_decode操作

更多可以访问 github.com/hggq/paozhu