20 Star 165 Fork 26

qiqi / orange

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
init.go 810 Bytes
一键复制 编辑 原始数据 按行查看 历史
qiqi 提交于 2021-06-16 15:15 . 调整脚手架结构
package tpl
import (
"sync"
)
var generatorTmpMap map[string]string
var mutex sync.Mutex
// init 初始化脚手架数据
func init() {
registerTpl("config", config)
registerTpl("indexgo", indexGo)
registerTpl("indexhtml", indexHtml)
registerTpl("main", mainGo)
registerTpl("job", jobGo)
registerTpl("middleware", middleware)
registerTpl("route", route)
registerTpl("jobRoute", jobRoute)
registerTpl("tpldemo", demoHtml)
}
// registerTpl 注册脚手架模板内容
func registerTpl(tplName string, content string) {
mutex.Lock()
defer mutex.Unlock()
if generatorTmpMap == nil {
generatorTmpMap = make(map[string]string)
}
generatorTmpMap[tplName] = content
}
func GetTmp(tmpName string) string {
if tmpContent, ok := generatorTmpMap[tmpName]; ok {
return tmpContent
}
return ""
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/zhucheer/orange.git
git@gitee.com:zhucheer/orange.git
zhucheer
orange
orange
v0.5.16

搜索帮助

344bd9b3 5694891 D2dac590 5694891