go-zero/tools/goctl/model/sql/template/new.go

12 lines
381 B
Go
Raw Normal View History

package template
2020-07-29 17:11:41 +08:00
// New defines an template for creating model instance
2020-07-29 17:11:41 +08:00
var New = `
func New{{.upperStartCamelObject}}Model(conn sqlx.SqlConn{{if .withCache}}, c cache.CacheConf{{end}}) {{.upperStartCamelObject}}Model {
return &default{{.upperStartCamelObject}}Model{
{{if .withCache}}CachedConn: sqlc.NewConn(conn, c){{else}}conn:conn{{end}},
table: {{.table}},
2020-07-29 17:11:41 +08:00
}
}
`