优化web代码
This commit is contained in:
parent
b1bfc4e385
commit
5d93eca50a
@ -33,6 +33,7 @@ const abortIndex int8 = math.MaxInt8 >> 1
|
|||||||
|
|
||||||
func newContext(log log.ILogger, engine *Engine, params *Params, skippedNodes *[]skippedNode) *Context {
|
func newContext(log log.ILogger, engine *Engine, params *Params, skippedNodes *[]skippedNode) *Context {
|
||||||
return &Context{
|
return &Context{
|
||||||
|
Log: log,
|
||||||
engine: engine,
|
engine: engine,
|
||||||
params: params,
|
params: params,
|
||||||
skippedNodes: skippedNodes,
|
skippedNodes: skippedNodes,
|
||||||
@ -102,8 +103,8 @@ func (this *Context) Handler() HandlerFunc {
|
|||||||
FullPath 返回匹配的路由完整路径。 对于未找到的路线
|
FullPath 返回匹配的路由完整路径。 对于未找到的路线
|
||||||
返回一个空字符串。
|
返回一个空字符串。
|
||||||
*/
|
*/
|
||||||
func (c *Context) FullPath() string {
|
func (this *Context) FullPath() string {
|
||||||
return c.fullPath
|
return this.fullPath
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Context) Next() {
|
func (this *Context) Next() {
|
||||||
@ -216,8 +217,8 @@ func (this *Context) GetUint(key string) (ui uint) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Context) GetUInt32(key string) (i uint32) {
|
func (this *Context) GetUInt32(key string) (i uint32) {
|
||||||
if val, ok := c.Get(key); ok && val != nil {
|
if val, ok := this.Get(key); ok && val != nil {
|
||||||
i, _ = val.(uint32)
|
i, _ = val.(uint32)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -491,7 +491,7 @@ func (this *Engine) prepareTrustedCIDRs() ([]*net.IPNet, error) {
|
|||||||
func (this *Engine) allocateContext() *Context {
|
func (this *Engine) allocateContext() *Context {
|
||||||
v := make(Params, 0, this.maxParams)
|
v := make(Params, 0, this.maxParams)
|
||||||
skippedNodes := make([]skippedNode, 0, this.maxSections)
|
skippedNodes := make([]skippedNode, 0, this.maxSections)
|
||||||
return &Context{Log: this.log, engine: this, params: &v, skippedNodes: &skippedNodes}
|
return newContext(this.log, this, &v, &skippedNodes) //& Context{Log: this.log, engine: this, params: &v, skippedNodes: &skippedNodes}
|
||||||
}
|
}
|
||||||
|
|
||||||
//日志接口-------------------------------------------------------------
|
//日志接口-------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user