1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-31 08:47:03 +00:00

New ':int64' and ':uint64' route path parameters - and - support the new uint64 for MVC (int64 was already supported there) - and - add ctx.Params().GetUint64 (GetInt64 was already there) - and - make the ':int or :number' to accept negative numbers with no digit limit (at low level) and rename the 'app.Macros().Int.RegisterFunc' to 'Number.RegisterFunc' because number can be any type of number not only standard go type limited - and - add alias for ':boolean' -> ':bool'. Finally, Update the examples but not the version yet, I have to provide a good README table to explain the end-developers how they can benefit by those changes and why the breaking change (which is to accept negative numbers via ':int') is for their own good and how they can make their own macro functions so they do not depend on the Iris builtn macro funcs only. More to come tomorrow, stay tuned

Former-commit-id: 3601abfc89478185afec3594375080778214283e
This commit is contained in:
Gerasimos (Makis) Maropoulos
2018-08-23 06:30:12 +03:00
parent 01b5f6089d
commit b019a281eb
28 changed files with 478 additions and 242 deletions

View File

@@ -63,7 +63,7 @@ Iris 是个底层框架, 对 MVC 模式有很好的支持,但不限制文件
### 路由、路由分组、路径动态参数、路由参数处理宏 、 自定义上下文
* `app.Get("{userid:int min(1)}", myHandler)`
* `app.Get("{userid:number min(1)}", myHandler)`
* `app.Post("{asset:path}", myHandler)`
* `app.Put("{custom:string regexp([a-z]+)}", myHandler)`
@@ -87,10 +87,10 @@ app.Get("/profile/me", userHandler)
// 匹配所有前缀为 /users/ 的 GET 请求
// 参数为数字,且 >= 1
app.Get("/user/{userid:int min(1)}", getUserHandler)
app.Get("/user/{userid:number min(1)}", getUserHandler)
// 匹配所有前缀为 /users/ 的 DELETE 请求
// 参数为数字,且 >= 1
app.Delete("/user/{userid:int min(1)}", deleteUserHandler)
app.Delete("/user/{userid:number min(1)}", deleteUserHandler)
// 匹配所有 GET 请求,除了 "/", "/about", 或其他以 "/assets/" 开头
// 因为它不会与其他路线冲突。