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 {
	
	{{range .data.PropList -}}
	//{{.Caption}}
	{{CamelizeStr .Name true}}   {{.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)
}
