processor.Execute() must use custom table if provided.

This commit is contained in:
Andy Truong 2020-07-10 11:10:20 +10:00
parent 3db62520b7
commit ff6ba50fc4
No known key found for this signature in database
GPG Key ID: 37D6D97FF6D6DFB0

View File

@ -8,6 +8,19 @@ import (
. "gorm.io/gorm/utils/tests"
)
func TestDeleteWithCustomTable(t *testing.T) {
type Entity struct{ ID int }
stmt := DB.
Session(&gorm.Session{DryRun: true}).
Table("my_entity").
Delete(&Entity{ID: 123}).Statement
if "my_entity" != stmt.Schema.Table {
t.Errorf("wrong table used. Expecting: my_table, actual: %s", stmt.Schema.Table)
}
}
func TestDelete(t *testing.T) {
var users = []User{*GetUser("delete", Config{}), *GetUser("delete", Config{}), *GetUser("delete", Config{})}