mirror of https://github.com/go-gorm/gorm.git
Include all primary fields when build where conditions
This commit is contained in:
parent
19aacb8fbb
commit
198fc47051
|
@ -164,7 +164,10 @@ func (scope *Scope) whereSql() (sql string) {
|
|||
}
|
||||
|
||||
if !scope.PrimaryKeyZero() {
|
||||
primaryConditions = append(primaryConditions, scope.primaryCondition(scope.AddToVars(scope.PrimaryKeyValue())))
|
||||
for _, field := range scope.PrimaryFields() {
|
||||
sql := fmt.Sprintf("(%v = %v)", scope.Quote(field.DBName), scope.AddToVars(field.Field.Interface()))
|
||||
primaryConditions = append(primaryConditions, sql)
|
||||
}
|
||||
}
|
||||
|
||||
for _, clause := range scope.Search.whereConditions {
|
||||
|
|
Loading…
Reference in New Issue