Fix Where with string

This commit is contained in:
Jinzhu 2015-01-20 11:16:41 +08:00
parent 2069364296
commit f8e4e16e09
2 changed files with 2 additions and 2 deletions

View File

@ -38,7 +38,7 @@ func (d *mysql) SqlTag(value reflect.Value, size int) string {
} }
case reflect.Struct: case reflect.Struct:
if value.Type() == timeType { if value.Type() == timeType {
return "datetime" return "timestamp"
} }
default: default:
if _, ok := value.Interface().([]byte); ok { if _, ok := value.Interface().([]byte); ok {

View File

@ -24,7 +24,7 @@ func (scope *Scope) buildWhereCondition(clause map[string]interface{}) (str stri
id, _ := strconv.Atoi(value) id, _ := strconv.Atoi(value)
return scope.primaryCondiation(scope.AddToVars(id)) return scope.primaryCondiation(scope.AddToVars(id))
} else { } else {
str = value str = fmt.Sprintf("(%v)", value)
} }
case int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64: case int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64:
return scope.primaryCondiation(scope.AddToVars(value)) return scope.primaryCondiation(scope.AddToVars(value))