1 Star 1 Fork 0

fast_api/api

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
match_default.go 645 Bytes
Copy Edit Raw Blame History
t.io authored 2023-09-03 08:44 +08:00 . use context replace mg
package match
import (
"gitee.com/fast_api/api/def"
"gitee.com/fast_api/api/log"
"net/url"
)
type MatchImpl struct {
store *store
}
// Match
// if match return func
func (m *MatchImpl) Match(url *url.URL) *def.Entry {
pv := make([]string, 10)
data, e := m.store.Get(url.Path, pv)
if data == nil {
return nil
}
ent := data.(*def.Entry)
for i := 0; i < len(e); i++ {
ent.Ids.Set(e[i], pv[i])
}
log.Debugf("Url path = %s is matched", url.Path)
return data.(*def.Entry)
}
func (m *MatchImpl) Add(key string, data interface{}) {
m.store.Add(key, data)
}
func NewMatchImpl() *MatchImpl {
return &MatchImpl{store: newStore()}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/fast_api/api.git
git@gitee.com:fast_api/api.git
fast_api
api
api
v0.1.0

Search