diff --git a/mysql.go b/mysql.go index 0dbc3d1d..666bb0aa 100644 --- a/mysql.go +++ b/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 { diff --git a/scope_private.go b/scope_private.go index a48f443b..2d5f3ff4 100644 --- a/scope_private.go +++ b/scope_private.go @@ -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))