fix: model generation bug on with cache (#1743)

* fix: model generation bug on with cache

* chore: refine template

* chore: fix test failure
This commit is contained in:
Kevin Wan
2022-04-02 15:36:06 +08:00
committed by GitHub
parent 83cacf51b7
commit dfd58c213c
3 changed files with 18 additions and 7 deletions

View File

@@ -8,9 +8,14 @@ import (
// ModelCustom defines a template for extension
const ModelCustom = `package {{.pkg}}
{{if .withCache}}
import (
"github.com/zeromicro/go-zero/core/stores/cache"
"github.com/zeromicro/go-zero/core/stores/sqlx"
)
{{else}}
import "github.com/zeromicro/go-zero/core/stores/sqlx"
{{end}}
var _ {{.upperStartCamelObject}}Model = (*custom{{.upperStartCamelObject}}Model)(nil)
type (