3.11 路由树-参数路径之参数值
(base) yanglei@yuanhong 16-valueOfParamRoute % tree ./
./
├── context.go
├── handleFunc.go
├── httpServer.go
├── httpServer_test.go
├── matchNode.go
├── node.go
├── router.go
├── router_test.go
└── serverInterface.go
0 directories, 9 filesPART1. 获取参数值
1.1 定义新类型
1.2 修改chlidOf()方法
chlidOf()方法1.3 修改findRoute()方法
findRoute()方法1.3.1 为matchNode结构体新增方法
matchNode结构体新增方法1.3.2 修改findRoute()方法
findRoute()方法PART2. 测试
2.1 修改已有的测试用例
2.1.1 修改路由查找功能的测试用例
2.1.2 通配符路由查找功能的测试用例
2.1.3 针对参数路由查找功能的测试用例
2.1.4 修改serve()方法
serve()方法2.2 运行测试用例
PART3. 将参数名/值传递至业务处理函数
3.1 修改Context
Context3.2 命中节点后将名值对传递给Context
ContextPART4. 参数路径的冲突问题
4.1 问题的产生
4.2 修改childOrCreate()方法
childOrCreate()方法4.3 测试
Last updated