1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-28 15:27:03 +00:00
1. Fix index, including both start and end. So Literal[start:end+1] will
be a valid part.

2. Replace any with string, add file param type

3. Start of making the evaluator, starting with regexp for param types
(these expression can be changed or/and overriden by user later on)


Former-commit-id: ab95265f953dadbf84170b543e1ff8840f9c4a14
This commit is contained in:
Gerasimos (Makis) Maropoulos
2017-03-27 22:33:19 +03:00
parent 251eeb6bd0
commit 126c4de29b
8 changed files with 158 additions and 55 deletions

View File

@@ -7,13 +7,13 @@
- No Breaking Changes.
- No performance cost if not used.
- Can convert a path for the existing routers, if no router is being used, then it will use its own, new, router.
- 4+1 basic parameter types: `int`, `string`, `alphabetical`, `path`, (wildcard), `any` based on regexp.
- 4+1 basic parameter types: `string`, `int`, `alphabetical`, `file`, `path` (file with any number of slashes), based on regexp.
- Each type has unlimited functions of its own, they should be able to be overriden.
- Give devs the ability to parse their function's arguments before use them and return a func which is the validator.
- Function will be a generic type(`interface{}`) in order to devs be able to use any type without boilerplate code for conversions,
can be done using reflection and reflect.Call, on .Boot time to parse the function automatically, and keep the returning validator function (already tested and worked).
- The `any` will be the default if dev use functions to the named path parameter but missing a type.
- If a type doesnt't contains a function of its own, then it will use the `any`'s, so `any` will contain global-use functions too.
- The `string` will be the default if dev use functions to the named path parameter but missing a type.
- If a type doesnt't contains a function of its own, then it will use the `string`'s, so `string` will contain global-use functions too.
## Preview
@@ -67,7 +67,7 @@ app.String.Set("isVersion", isVersionStrValidator)
app.String.Set("len", lenStrValidator)
```
`/uploads/{filepath:tail contains(.) else 403}`
`/uploads/{fullpath:path contains(.) else 403}`
```go
[...]