Ai
1 Star 0 Fork 0

whmmm/truss

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
hooks.go 662 Bytes
一键复制 编辑 原始数据 按行查看 历史
Zaq? Wiedmann 提交于 2019-01-17 08:47 +08:00 . Metaverse merge (#262)
package handlers
import (
"io"
"strings"
"github.com/metaverse/truss/gengokit"
"github.com/metaverse/truss/gengokit/handlers/templates"
)
const HookPath = "handlers/hooks.gotemplate"
// NewHook returns a new HookRender
func NewHook(prev io.Reader) gengokit.Renderable {
return &HookRender{
prev: prev,
}
}
type HookRender struct {
prev io.Reader
}
// Render will return the existing file if it exists, otherwise it will return
// a brand new copy from the template.
func (h *HookRender) Render(_ string, _ *gengokit.Data) (io.Reader, error) {
if h.prev == nil {
return strings.NewReader(templates.Hook), nil
} else {
return h.prev, nil
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/whmmm/truss.git
git@gitee.com:whmmm/truss.git
whmmm
truss
truss
v0.1.0

搜索帮助