工具
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

26 lines
763 B

package servicegen
import (
"git.ouxuan.net/tommy/hasaki-ctl/servicegen/tpl"
"path/filepath"
"text/template"
)
var (
apiTmpl = CreateTpl("servicegen/tpl/api.tpl")
apiPreTmpl = CreateTpl("servicegen/tpl/api_task.tpl")
apiTaskTmpl = CreateTpl("servicegen/tpl/api_task.tpl")
apiTestTmpl = CreateTpl("servicegen/tpl/api_test.tpl")
dbModelTmpl = CreateTpl("servicegen/tpl/db_model.tpl")
optionsTmpl = CreateTpl("servicegen/tpl/options.tpl")
externalTmpl = CreateTpl("servicegen/tpl/external.tpl")
)
func CreateTpl(filename string)*template.Template {
body, err := tpl.Asset(filename)
//body, err := ioutil.ReadFile(filename)
if err != nil {
panic(err)
}
return template.Must(template.New(filepath.Base(filename)).Parse(string(body)))
}