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.
29 lines
820 B
29 lines
820 B
package servicegen
|
|
|
|
import (
|
|
"git.ouxuan.net/tommy/hasaki-ctl/servicegen/tpl"
|
|
"path/filepath"
|
|
"text/template"
|
|
)
|
|
|
|
var (
|
|
apiTpl = CreateTpl("api.tpl")
|
|
apiPreTpl = CreateTpl("api_pre.tpl")
|
|
apiTaskTpl = CreateTpl("api_task.tpl")
|
|
apiTestTpl = CreateTpl("api_test.tpl")
|
|
dbModelTpl = CreateTpl("db_model.tpl")
|
|
optionsTpl = CreateTpl("options.tpl")
|
|
externalTpl = CreateTpl("external.tpl")
|
|
configJsonTpl = CreateTpl("configjson.tpl")
|
|
mainTpl = CreateTpl("main.tpl")
|
|
initializeTpl = CreateTpl("initialize.tpl")
|
|
adminInitializeTpl = CreateTpl("initialize_admin.tpl")
|
|
)
|
|
|
|
func CreateTpl(filename string)*template.Template {
|
|
body, err := tpl.Asset(filepath.Join("servicegen/tpl", filename))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return template.Must(template.New(filepath.Base(filename)).Parse(string(body)))
|
|
}
|