2020-08-19 10:41:19 +08:00
|
|
|
package template
|
2020-07-29 17:11:41 +08:00
|
|
|
|
2021-02-26 16:11:47 +08:00
|
|
|
// New defines an template for creating model instance
|
2020-07-29 17:11:41 +08:00
|
|
|
var New = `
|
2020-11-24 22:36:23 +08:00
|
|
|
func New{{.upperStartCamelObject}}Model(conn sqlx.SqlConn{{if .withCache}}, c cache.CacheConf{{end}}) {{.upperStartCamelObject}}Model {
|
|
|
|
return &default{{.upperStartCamelObject}}Model{
|
2020-08-19 10:41:19 +08:00
|
|
|
{{if .withCache}}CachedConn: sqlc.NewConn(conn, c){{else}}conn:conn{{end}},
|
2021-07-23 11:45:15 +08:00
|
|
|
table: {{.table}},
|
2020-07-29 17:11:41 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
`
|