forked from mirror/gorm
Remove unnecessary IsIgnored check
This commit is contained in:
parent
930c7b80a1
commit
e2c989be17
2
scope.go
2
scope.go
|
@ -444,7 +444,7 @@ func (scope *Scope) Fields(noRelations ...bool) map[string]*Field {
|
|||
if value, ok := fields[field.DBName]; ok {
|
||||
if value.IsIgnored {
|
||||
fields[field.DBName] = field
|
||||
} else if !value.IsIgnored {
|
||||
} else {
|
||||
panic(fmt.Sprintf("Duplicated column name for %v (%v)\n", scope.typeName(), fileWithLineNum()))
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -300,7 +300,7 @@ func (s *Scope) joinsSql() string {
|
|||
|
||||
func (scope *Scope) prepareQuerySql() {
|
||||
if scope.Search.Raw {
|
||||
scope.Raw(strings.TrimRight(strings.TrimLeft(scope.CombinedConditionSql(), "WHERE ("), ")"))
|
||||
scope.Raw(strings.TrimSuffix(strings.TrimPrefix(scope.CombinedConditionSql(), " WHERE ("), ")"))
|
||||
} else {
|
||||
scope.Raw(fmt.Sprintf("SELECT %v %v FROM %v %v", scope.topSql(), scope.selectSql(), scope.QuotedTableName(), scope.CombinedConditionSql()))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue