feat: let model customizable (#1738)

This commit is contained in:
Kevin Wan
2022-04-01 22:19:52 +08:00
committed by GitHub
parent 7e0b0ab0b1
commit 6dccfa29fd
17 changed files with 123 additions and 52 deletions

View File

@@ -1,7 +1,8 @@
package template
// Update defines a template for generating update codes
var Update = `
const (
// Update defines a template for generating update codes
Update = `
func (m *default{{.upperStartCamelObject}}Model) Update(ctx context.Context, data *{{.upperStartCamelObject}}) error {
{{if .withCache}}{{.keys}}
_, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
@@ -13,5 +14,6 @@ func (m *default{{.upperStartCamelObject}}Model) Update(ctx context.Context, dat
}
`
// UpdateMethod defines an interface method template for generating update codes
var UpdateMethod = `Update(ctx context.Context, data *{{.upperStartCamelObject}}) error`
// UpdateMethod defines an interface method template for generating update codes
UpdateMethod = `Update(ctx context.Context, data *{{.upperStartCamelObject}}) error`
)