Skip to content

Develop - 完善HttpContext,提升易用性#98

Merged
devfeel merged 2 commits intomasterfrom
develop
Jan 3, 2018
Merged

Develop - 完善HttpContext,提升易用性#98
devfeel merged 2 commits intomasterfrom
develop

Conversation

@devfeel
Copy link
Owner

@devfeel devfeel commented Jan 3, 2018

Version 1.4.2

  • Context新增QueryInt\QueryInt64接口,用于简化获取Int类型的Get参数,如果参数未传入或不是合法整形,返回0
  • Context接口调整:除Write外,其他WriteXXX接口,返回值从(int, error)调整为error
  • 带来的变化:
	app.HttpServer.GET("/index", func(ctx dotweb.Context) error{
		_, err := ctx.WriteString("welcome to my first web!")
		return err
	})

简化为

	app.HttpServer.GET("/index", func(ctx dotweb.Context) error{
		return ctx.WriteString("welcome to my first web!")
	})
  • 同步更新example代码
  • 2018-01-03 22:00

pzrr@qq.com and others added 2 commits January 2, 2018 01:01
* dotweb新增ExcludeUse接口,用于设置指定排除路由的中间件,fixed for #94 建议增加exuse方法用来实现exclude uri功能
* 调整dotweb部分内部函数名称
* 重构Middleware实现,优化代码结构,使流程更清晰
* Node新增AppMiddlewares与GroupMiddlewares,用于存储App级、Group级的中间件实例
* Middleware新增Exclude相关接口
* Exclude(routers ...string)函数,用于指定不生效的路由
* HasExclude() bool函数,用于判定当前中间件实例是否存在排除路由
* ExistsExcludeRouter(router string) bool函数,用于判定当前中间件实例的排除路由中是否存在指定路由
* middleware执行优先级:
- 优先级1:app级别middleware
- 优先级2:group级别middleware
- 优先级:router级别middleware
* 更新example/middleware
* 2018-01-01 23:00:00
* Context新增QueryInt\QueryInt64接口,用于简化获取Int类型的Get参数,如果参数未传入或不是合法整形,返回0
* Context接口调整:除Write外,其他WriteXXX接口,返回值从(int, error)调整为error
* 带来的变化:
```
	app.HttpServer.GET("/index", func(ctx dotweb.Context) error{
		_, err := ctx.WriteString("welcome to my first web!")
		return err
	})
```
简化为
```
	app.HttpServer.GET("/index", func(ctx dotweb.Context) error{
		return ctx.WriteString("welcome to my first web!")
	})
```
* 同步更新example代码
* 2018-01-03 22:00
@devfeel devfeel merged commit 129df76 into master Jan 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant