PostgreSQL连接管理器,提供面向Actor数据的CRUD操作。
More...
#include <npostgresql_manage.h>
|
| static bool | init () |
| | 初始化管理器,从配置读取序列化模式。
|
| template<typename T> |
| static bool | save (npostgresql *adb, T *adata) |
| | 将单个Actor数据保存到PostgreSQL(UPSERT)。
|
| template<typename T> |
| static bool | save (npostgresql *adb, i64_actorid aid) |
| | 按Actor ID从缓存加载数据并保存到PostgreSQL。
|
| template<typename T> |
| static bool | save (npostgresql *adb) |
| | 将指定类型的所有缓存数据批量保存到PostgreSQL。
|
| template<typename T> |
| static bool | del (npostgresql *adb, i64_actorid aid) |
| | 从PostgreSQL删除指定Actor的数据记录。
|
| static const char * | where_area () |
| | 获取区域过滤SQL条件片段。
|
| template<typename T> |
| static bool | select (npostgresql *adb, i64_actorid aid) |
| | 从PostgreSQL加载单个Actor数据到缓存。
|
| template<typename T> |
| static bool | select (npostgresql *adb) |
| | 从PostgreSQL加载指定类型的全部可见区域数据到缓存。
|
| template<typename T> |
| static bool | select (npostgresql *adb, std::set< int64_t > &aidset) |
| | 从PostgreSQL加载指定类型的可见区域ID集合(仅ID,不含数据)。
|
PostgreSQL连接管理器,提供面向Actor数据的CRUD操作。
将查询路由到正确的连接池,支持序列化存储和区域过滤查询。 所有方法均为静态方法,禁止实例化。
◆ del()
从PostgreSQL删除指定Actor的数据记录。
- Template Parameters
-
- Parameters
-
| adb | PostgreSQL连接实例 |
| aid | Actor ID |
- Returns
- true 删除成功
-
false 删除失败
◆ init()
| bool ngl::npostgresql_manage::init |
( |
| ) |
|
|
inlinestatic |
初始化管理器,从配置读取序列化模式。
- Returns
- true 初始化成功
-
false 配置缺失或读取失败
◆ save() [1/3]
template<typename T>
| bool ngl::npostgresql_manage::save |
( |
npostgresql * | adb | ) |
|
|
inlinestatic |
将指定类型的所有缓存数据批量保存到PostgreSQL。
- Template Parameters
-
- Parameters
-
- Returns
- true 始终返回true
◆ save() [2/3]
按Actor ID从缓存加载数据并保存到PostgreSQL。
- Template Parameters
-
- Parameters
-
| adb | PostgreSQL连接实例 |
| aid | Actor ID |
- Returns
- true 保存成功
-
false 数据未找到或保存失败
◆ save() [3/3]
template<typename T>
| bool ngl::npostgresql_manage::save |
( |
npostgresql * | adb, |
|
|
T * | adata ) |
|
inlinestatic |
将单个Actor数据保存到PostgreSQL(UPSERT)。
- Template Parameters
-
- Parameters
-
| adb | PostgreSQL连接实例 |
| adata | 要保存的数据指针 |
- Returns
- true 保存成功
-
false 保存失败
◆ select() [1/3]
template<typename T>
| bool ngl::npostgresql_manage::select |
( |
npostgresql * | adb | ) |
|
|
inlinestatic |
从PostgreSQL加载指定类型的全部可见区域数据到缓存。
- Template Parameters
-
- Parameters
-
- Returns
- true 加载成功
-
false 加载失败
◆ select() [2/3]
从PostgreSQL加载单个Actor数据到缓存。
- Template Parameters
-
- Parameters
-
| adb | PostgreSQL连接实例 |
| aid | Actor ID |
- Returns
- true 加载成功
-
false 加载失败
◆ select() [3/3]
template<typename T>
| bool ngl::npostgresql_manage::select |
( |
npostgresql * | adb, |
|
|
std::set< int64_t > & | aidset ) |
|
inlinestatic |
从PostgreSQL加载指定类型的可见区域ID集合(仅ID,不含数据)。
- Template Parameters
-
- Parameters
-
| adb | PostgreSQL连接实例 |
| aidset | 输出参数,存储加载到的ID集合 |
- Returns
- true 加载成功
-
false 加载失败
◆ where_area()
| const char * ngl::npostgresql_manage::where_area |
( |
| ) |
|
|
inlinestatic |
获取区域过滤SQL条件片段。
- Returns
- const char* SQL WHERE子句中的区域过滤条件
- Note
- 使用std::call_once确保只初始化一次。
The documentation for this class was generated from the following files: