DB.First(&result,"name1 = @name OR name2 = @name OR name3 = @name",sql.Named("name","jinzhu2"))
AssertEqual(t,result,namedUser)
varresult2NamedUser
DB.Where("name1 = @name OR name2 = @name OR name3 = @name",sql.Named("name","jinzhu2")).First(&result2)
AssertEqual(t,result2,namedUser)
varresult3NamedUser
DB.Where("name1 = @name OR name2 = @name OR name3 = @name",map[string]interface{}{"name":"jinzhu2"}).First(&result3)
AssertEqual(t,result3,namedUser)
varresult4NamedUser
iferr:=DB.Raw("SELECT * FROM named_users WHERE name1 = @name OR name2 = @name2 OR name3 = @name",sql.Named("name","jinzhu-none"),sql.Named("name2","jinzhu2")).Find(&result4).Error;err!=nil{
iferr:=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{