feat(instance):migrate instance containers to type-safe generics #4630
+57
−51
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
变更说明
本 PR 主要对代码库进行了重构,以提升类型安全性和优化连接管理实现。
详细变更
1. 数据库连接管理优化
RegisterNilChecker方法返回实例以支持链式调用,涉及KVMap、ListKVMap、TSet、AVLKVTree、BKVTree、RedBlackKVTree等多个容器类型Core结构体中links字段类型为类型安全的KVMap[ConfigNode, *sql.DB]KVMap替代原始 map 类型提升类型安全性2. 数据库驱动类型安全增强
conflictKeySet从gset.New修改为gset.NewStrSet3. 配置文件适配器类型安全改进
jsonMap从StrAnyMap类型更改为泛型KVMap[string, *gjson.Json]类型jsonMapChecker函数用于 JSON 对象验证NewKVMapWithChecker替代NewStrAnyMap提高类型安全性影响范围