| 12345678910111213141516171819202122232425262728 |
- package apigen
- import "git.qianqiusoft.com/qianqiusoft/light-apiengine-client/code_gen/utils"
- const beanTemplate = `
- package models
- import (
- //__import_packages__
- )
- {{$structName := CamelizeStr .data.Name true}}
- //{{.data.Desc}}
- type {{$structName}} struct {
- {{if ne .data.Inher ""}}{{FixType .data.Inher}}{{end}}
- {{range .data.PropList -}}
- //{{.Caption}}
- {{CamelizeStr .Name true}} {{FixType .Type}} {{Backquote}}json:"{{.Name}}"{{Backquote}}
- {{end}}
- }
- func init() {
- AddTableName("{{.data.Name}}")
- }
- `
- func GenBean(templateData interface{}, params map[string]interface{}) ([]byte, error) {
- return utils.GenTemplate(beanTemplate, templateData, params)
- }
|