1
0
mirror of https://github.com/astaxie/beego.git synced 2025-07-16 02:32:17 +00:00

Deprecated old web module

This commit is contained in:
Ming Deng
2020-08-05 21:57:20 +08:00
parent 02972d8702
commit 882aa9b967
17 changed files with 258 additions and 0 deletions

View File

@@ -31,6 +31,7 @@ var (
// fixRouter stores Fixed Router
// wildcard stores params
// leaves store the endpoint information
// Deprecated: using pkg/, we will delete this in v2.1.0
type Tree struct {
//prefix set for static router
prefix string
@@ -43,12 +44,14 @@ type Tree struct {
}
// NewTree return a new Tree
// Deprecated: using pkg/, we will delete this in v2.1.0
func NewTree() *Tree {
return &Tree{}
}
// AddTree will add tree to the exist Tree
// prefix should has no params
// Deprecated: using pkg/, we will delete this in v2.1.0
func (t *Tree) AddTree(prefix string, tree *Tree) {
t.addtree(splitPath(prefix), tree, nil, "")
}
@@ -200,6 +203,7 @@ func filterTreeWithPrefix(t *Tree, wildcards []string, reg string) {
}
// AddRouter call addseg function
// Deprecated: using pkg/, we will delete this in v2.1.0
func (t *Tree) AddRouter(pattern string, runObject interface{}) {
t.addseg(splitPath(pattern), runObject, nil, "")
}
@@ -283,6 +287,7 @@ func (t *Tree) addseg(segments []string, route interface{}, wildcards []string,
}
// Match router to runObject & params
// Deprecated: using pkg/, we will delete this in v2.1.0
func (t *Tree) Match(pattern string, ctx *context.Context) (runObject interface{}) {
if len(pattern) == 0 || pattern[0] != '/' {
return nil