1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-24 20:35:59 +00:00

add my new trie data structure implementation written from scratch and specifically designed for HTTP (and Iris) - see https://github.com/kataras/muxie for the net/http version of it

Former-commit-id: 4eed1585f29b57418b61f6de058f5d6db4bb98bf
This commit is contained in:
Gerasimos (Makis) Maropoulos
2018-10-15 10:49:09 +03:00
parent 29a4354e1d
commit 3002736086
24 changed files with 575 additions and 648 deletions

View File

@@ -12,14 +12,6 @@ import (
"github.com/kataras/iris/macro/interpreter/lexer"
)
const (
// ParamStart the character in string representation where the underline router starts its dynamic named parameter.
ParamStart = ":"
// WildcardParamStart the character in string representation where the underline router starts its dynamic wildcard
// path parameter.
WildcardParamStart = "*"
)
// Param receives a parameter name prefixed with the ParamStart symbol.
func Param(name string) string {
return prefix(name, ParamStart)
@@ -35,10 +27,8 @@ func WildcardParam(name string) string {
func convertMacroTmplToNodePath(tmpl macro.Template) string {
routePath := tmpl.Src
if len(tmpl.Params) > 0 {
if routePath[len(routePath)-1] == '/' {
routePath = routePath[0 : len(routePath)-2] // remove the last "/" if macro syntax instead of underline's.
}
if len(routePath) > 1 && routePath[len(routePath)-1] == '/' {
routePath = routePath[0 : len(routePath)-1] // remove any last "/"
}
// if it has started with {} and it's valid