2023-03-09 21:34:58 +08:00
|
|
|
func new{{.upperStartCamelObject}}Model(conn sqlx.SqlConn{{if .withCache}}, c cache.CacheConf, opts ...cache.Option{{end}}) *default{{.upperStartCamelObject}}Model {
|
2020-11-24 22:36:23 +08:00
|
|
|
return &default{{.upperStartCamelObject}}Model{
|
2023-03-09 21:34:58 +08:00
|
|
|
{{if .withCache}}CachedConn: sqlc.NewConn(conn, c, opts...){{else}}conn:conn{{end}},
|
2021-07-23 11:45:15 +08:00
|
|
|
table: {{.table}},
|
2020-07-29 17:11:41 +08:00
|
|
|
}
|
|
|
|
|
}
|
2023-05-24 15:34:26 +08:00
|
|
|
|
|
|
|
|
func (m *default{{.upperStartCamelObject}}Model) withSession(session sqlx.Session) *default{{.upperStartCamelObject}}Model {
|
|
|
|
|
return &default{{.upperStartCamelObject}}Model{
|
|
|
|
|
{{if .withCache}}CachedConn:m.CachedConn.WithSession(session){{else}}conn:sqlx.NewSqlConnFromSession(session){{end}},
|
|
|
|
|
table: {{.table}},
|
|
|
|
|
}
|
|
|
|
|
}
|