Browse Source

init template

master
小黄 4 years ago
parent
commit
c26f062e1b
  1. 23
      servicegen/tmpl.go

23
servicegen/tmpl.go

@ -1,7 +1,7 @@
package servicegen
import (
"path/filepath"
"io/ioutil"
"text/template"
)
@ -16,11 +16,18 @@ var (
)
func init() {
apiTmpl = template.Must(template.ParseFiles(filepath.Join("servicegen/tmpl/api.tmpl")))
apiPreTmpl = template.Must(template.ParseFiles("servicegen/tmpl/api_pre.tmpl"))
apiTaskTmpl = template.Must(template.ParseFiles("servicegen/tmpl/api_task.tmpl"))
apiTestTmpl = template.Must(template.ParseFiles("servicegen/tmpl/api_test.tmpl"))
dbModelTmpl = template.Must(template.ParseFiles("servicegen/tmpl/db_model.tmpl"))
optionsTmpl = template.Must(template.ParseFiles("servicegen/tmpl/external.tmpl"))
externalTmpl = template.Must(template.ParseFiles("servicegen/tmpl/options.tmpl"))
body, _ := ioutil.ReadFile("servicegen/tmpl/api.tmpl")
apiTmpl = template.Must(template.New("api.tmpl").Parse(string(body)))
body, _ = ioutil.ReadFile("servicegen/tmpl/api_pre.tmpl")
apiPreTmpl = template.Must(template.New("api_pre.tmpl").Parse(string(body)))
body, _ = ioutil.ReadFile("servicegen/tmpl/api_task.tmpl")
apiTaskTmpl = template.Must(template.New("api_task.tmpl").Parse(string(body)))
body, _ = ioutil.ReadFile("servicegen/tmpl/api_test.tmpl")
apiTestTmpl = template.Must(template.New("api_test.tmpl").Parse(string(body)))
body, _ = ioutil.ReadFile("servicegen/tmpl/db_model.tmpl")
dbModelTmpl = template.Must(template.New("db_model.tmpl").Parse(string(body)))
body, _ = ioutil.ReadFile("servicegen/tmpl/options.tmpl")
optionsTmpl = template.Must(template.New("options.tmpl").Parse(string(body)))
body, _ = ioutil.ReadFile("servicegen/tmpl/external.tmpl")
externalTmpl = template.Must(template.New("external.tmpl").Parse(string(body)))
}
Loading…
Cancel
Save