feat: update gen_model to support provider

This commit is contained in:
yanghao05
2025-05-23 19:31:34 +08:00
parent 4740d97695
commit 0758badc81
6 changed files with 158 additions and 86 deletions

View File

@@ -1,14 +1,9 @@
package models
package model
import (
"github.com/sirupsen/logrus"
log "github.com/sirupsen/logrus"
)
// @provider
type {{.CamelTable}}Model struct {
log *logrus.Entry `inject:"false"`
}
func (m *{{.CamelTable}}Model) Prepare() error {
m.log = logrus.WithField("model", "{{.CamelTable}}Model")
return nil
func (m *{{.PascalTable}}) log() *log.Entry {
return log.WithField("model", "{{.PascalTable}}Model")
}