gen
gen copied to clipboard
If there is a unique index in the generated unit test, an error will be reported.
GORM Playground Link
https://github.com/go-gorm/playground/pull/1
Description
If there is a unique index in the generated unit test, an error will be reported.
func Test_tblUserQuery(t *testing.T) {
.....
err = _do.CreateInBatches([]*model.TblUser{{}, {}}, 10)
if err != nil {
t.Error("create item in table <tbl_user> fail:", err)
}
}
tbl_user.gen_test.go:57: create item in table <tbl_user> fail: UNIQUE constraint failed: tbl_user.ns, tbl_user.identity_id, tbl_user.name