Test map with named argument for raw sql

This commit is contained in:
Jinzhu 2020-07-10 12:52:01 +08:00
parent bba569af2b
commit c0319f6eed
1 changed files with 1 additions and 1 deletions

View File

@ -49,7 +49,7 @@ func TestNamedArg(t *testing.T) {
} }
var result5 NamedUser var result5 NamedUser
if err := DB.Raw("SELECT * FROM named_users WHERE (name1 = @name AND name3 = @name) AND name2 = @name2", sql.Named("name", "jinzhu-new"), sql.Named("name2", "jinzhu-new2")).Find(&result5).Error; err != nil { if err := DB.Raw("SELECT * FROM named_users WHERE (name1 = @name AND name3 = @name) AND name2 = @name2", map[string]interface{}{"name": "jinzhu-new", "name2": "jinzhu-new2"}).Find(&result5).Error; err != nil {
t.Errorf("failed to update with named arg") t.Errorf("failed to update with named arg")
} }