Open
Description
It works well with gorm v1.25.10. But with V1.25.12, I got this error :
# gorm.io/plugin/dbresolver
../../go/pkg/mod/gorm.io/plugin/[email protected]/dbresolver.go:147:5: unknown field PreparedSQL in struct literal of type gorm.PreparedStmtDB
gen .sql
My code :
package main
import (
"gorm.io/driver/mysql"
"gorm.io/gen"
"gorm.io/gorm"
)
func main() {
//-outPath=./models -modelPkgName="models" -fieldWithTypeTag -onlyModel -fieldWithIndexTag
g := gen.NewGenerator(gen.Config{
OutPath: "model",
FieldWithIndexTag: true,
FieldWithTypeTag: true,
ModelPkgPath: "model",
})
g.WithImportPkgPath("gorm.io/plugin/soft_delete")
gormdb, err := gorm.Open(mysql.Open("root:123456@(localhost:3306)/ginstartup?charset=utf8mb4&parseTime=True&loc=Local"))
if err != nil {
panic(err)
}
g.UseDB(gormdb) // reuse your gorm db
g.GenerateAllTable(gen.FieldType("deleted_at", "soft_delete.DeletedAt"))
// Generate the code
g.Execute()
}
Metadata
Metadata
Assignees
Labels
No labels