|
NexusForce 1.0.0
A Modern C++ Library with extended functionality, web components, and utility libraries
|
数据库连接配置结构 更多...
#include <db_config.hpp>
静态 Public 成员函数 | |
| static db_config | for_postgresql (const string &db="postgres") |
| 创建PostgreSQL数据库配置 | |
| static db_config | for_mysql (const string &db) |
| 创建MySQL数据库配置 | |
| static db_config | for_sqlite (const string &file) |
| 创建SQLite3数据库配置 | |
| static db_config | for_redis (const string &db) |
| 创建Redis数据库配置 | |
Public 属性 | |
| string | username {} |
| 数据库用户名 | |
| string | password {} |
| 数据库密码 | |
| string | database {} |
| 数据库名 | |
| string | host = "127.0.0.1" |
| 数据库主机地址 | |
| string | charset {} |
| 数据库字符集 | |
| uint16_t | port = 0 |
| 数据库端口号 | |
创建MySQL数据库配置
| db | 数据库名 |
默认参数:
创建PostgreSQL数据库配置
| db | 数据库名 |
默认参数:
创建Redis数据库配置
| db | 数据库编号(作为字符串,如"0") |
默认参数:
创建SQLite3数据库配置
| file | 数据库文件路径 |
对于SQLite,host和port字段被忽略, database字段存储文件路径。