package
module
Version:
v0.3.0
Opens a new window with list of versions in this module.
Published: Jan 26, 2020
License: MIT
Opens a new window with license information.
Imports: 2
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
OneBD
[TOC]
设计思路
路由
核心函数为注册和子路由
- SubRouter(prefix string) Router
- prefix 匹配规则
- 形如 /abc/efd/:varA/*varB
- :会截取//之前作为变量内容,*匹配之后所有字符
- 优先级 字符>变量>通配 (/abc > /abc/edf > /abc/:varC > /abc/*varD > /:varA > /*varB)
- Set(prefix string, fc func() Handler, allowedMethods ...rfc.Method)
- prefix 匹配规则同上
- fc 生成新handler的方法,用于构建handler池,避免每次生成
- allowedMethods 运行通过的http方法, 缺省则默认get
核心对象
整体应用的全局配置和管理
请求的周期管理
handler缓存池 避免每次去创建
路由 根据请求路径匹配正确的handler去处理
辅助handler处理request和response
TODO:
-
goroutine pool
-
hook
-
log
-
error
-
cache
-
distribute
-
websocket
-
MQ
-
session
-
auth
注意
- 本项目多次使用对象缓存和复用技术,谨慎使用衍生go程读取或修改原go程数据
更新
Documentation
¶
Source Files
¶
Directories
¶
Click to show internal directories.
Click to hide internal directories.