1 Star 0 Fork 0

eatmoreapple/regia

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
starter.go 1.51 KB
一键复制 编辑 原始数据 按行查看 历史
eatmoreapple 提交于 2022-07-09 13:51 . add file header and code note
// Copyright 2021 eatmoreapple. All rights reserved.
// Use of this source code is governed by a GPL style
// license that can be found in the LICENSE file.
package regia
import (
"fmt"
"github.com/eatmoreapple/regia/internal"
)
var Banner = `
██████╗ ███████╗ ██████╗ ██╗ █████╗
██╔══██╗██╔════╝██╔════╝ ██║██╔══██╗
██████╔╝█████╗ ██║ ███╗██║███████║
██╔══██╗██╔══╝ ██║ ██║██║██╔══██║
██║ ██║███████╗╚██████╔╝██║██║ ██║
╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═╝╚═╝ ╚═╝
`
const _regia = "[REGIA]"
// Starter will be called while engine is running
type Starter interface {
Start(engine *Engine) error
}
type BannerStarter struct{ Banner string }
func (b BannerStarter) Start(engine *Engine) error {
fmt.Println(b.Banner)
return nil
}
type UrlInfoStarter struct{}
func (u UrlInfoStarter) Start(engine *Engine) error {
for method, nodes := range engine.methodsTree {
m := internal.FormatColor(97, method)
for _, n := range nodes {
handleCount := internal.BlueString(fmt.Sprintf("%d handlers", len(n.group)))
path := internal.YellowString(n.path)
fmt.Printf("%-15s %-18s %-18s %s\n", _regia, m, handleCount, path)
}
}
return nil
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/eatmoreapple/regia.git
git@gitee.com:eatmoreapple/regia.git
eatmoreapple
regia
regia
main

搜索帮助

0d507c66 1850385 C8b1a773 1850385