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

11 lines
329 B
Go
Raw Normal View History

2020-08-12 09:19:37 +08:00
package template
2020-07-29 17:11:41 +08:00
var New = `
2020-08-16 23:28:01 +08:00
func New{{.upperStartCamelObject}}Model(conn sqlx.SqlConn,{{if .withCache}} c cache.CacheConf,{{end}} table string) *{{.upperStartCamelObject}}Model {
2020-08-12 09:19:37 +08:00
return &{{.upperStartCamelObject}}Model{
2020-08-16 23:28:01 +08:00
{{if .withCache}}CachedConn: sqlc.NewConn(conn, c){{else}}conn:conn{{end}},
2020-07-29 17:11:41 +08:00
table: table,
}
}
`