我想在我的代码中使用gorm,但不幸的是,当我运行时go run *.go,我看到了这个错误。/var/www/html/src/gorm.io/gorm/utils/utils.go:46:30: reflect.ValueOf(val).IsZero undefined (type reflect.Value has no field or method IsZero)这是我的代码:package mainimport ( "gorm.io/gorm" "gorm.io/driver/sqlite")type Product struct { gorm.Model Code string Price uint}func main() {db, err := gorm.Open(sqlite.Open("test.db"), &gorm.Config{})if err != nil { panic("failed to connect database")}// Migrate the schemadb.AutoMigrate(&Product{})// Createdb.Create(&Product{Code: "D42", Price: 100})}
添加回答
举报
0/150
提交
取消