工具
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
907 B

4 years ago
  1. package servicegen
  2. import (
  3. "path/filepath"
  4. "text/template"
  5. )
  6. var (
  7. apiTmpl *template.Template
  8. apiPreTmpl *template.Template
  9. apiTaskTmpl *template.Template
  10. apiTestTmpl *template.Template
  11. dbModelTmpl *template.Template
  12. optionsTmpl *template.Template
  13. externalTmpl *template.Template
  14. )
  15. func init() {
  16. apiTmpl = template.Must(template.ParseFiles(filepath.Join("servicegen/tmpl/api.tmpl")))
  17. apiPreTmpl = template.Must(template.ParseFiles("servicegen/tmpl/api_pre.tmpl"))
  18. apiTaskTmpl = template.Must(template.ParseFiles("servicegen/tmpl/api_task.tmpl"))
  19. apiTestTmpl = template.Must(template.ParseFiles("servicegen/tmpl/api_test.tmpl"))
  20. dbModelTmpl = template.Must(template.ParseFiles("servicegen/tmpl/db_model.tmpl"))
  21. optionsTmpl = template.Must(template.ParseFiles("servicegen/tmpl/external.tmpl"))
  22. externalTmpl = template.Must(template.ParseFiles("servicegen/tmpl/options.tmpl"))
  23. }