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

12 lines
393 B
Go
Raw Normal View History

package template
2020-07-29 17:11:41 +08:00
2022-04-01 22:19:52 +08:00
// New defines the template for creating model instance.
const New = `
func new{{.upperStartCamelObject}}Model(conn sqlx.SqlConn{{if .withCache}}, c cache.CacheConf{{end}}) *default{{.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
}
}
`