mirror of https://github.com/go-gorm/gorm.git
Fix Where with string
This commit is contained in:
parent
2069364296
commit
f8e4e16e09
2
mysql.go
2
mysql.go
|
@ -38,7 +38,7 @@ func (d *mysql) SqlTag(value reflect.Value, size int) string {
|
|||
}
|
||||
case reflect.Struct:
|
||||
if value.Type() == timeType {
|
||||
return "datetime"
|
||||
return "timestamp"
|
||||
}
|
||||
default:
|
||||
if _, ok := value.Interface().([]byte); ok {
|
||||
|
|
|
@ -24,7 +24,7 @@ func (scope *Scope) buildWhereCondition(clause map[string]interface{}) (str stri
|
|||
id, _ := strconv.Atoi(value)
|
||||
return scope.primaryCondiation(scope.AddToVars(id))
|
||||
} else {
|
||||
str = value
|
||||
str = fmt.Sprintf("(%v)", value)
|
||||
}
|
||||
case int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64:
|
||||
return scope.primaryCondiation(scope.AddToVars(value))
|
||||
|
|
Loading…
Reference in New Issue