Handle string as primary key
This commit is contained in:
parent
9739cb853c
commit
9d085dafdb
@ -21,7 +21,11 @@ func (scope *Scope) buildWhereCondition(clause map[string]interface{}) (str stri
|
||||
if regexp.MustCompile("^\\s*\\d+\\s*$").MatchString(value) {
|
||||
return scope.primaryCondition(scope.AddToVars(value))
|
||||
} else if value != "" {
|
||||
str = fmt.Sprintf("(%v)", value)
|
||||
if regexp.MustCompile("^[a-zA-Z0-9]+$").MatchString(value) {
|
||||
return scope.primaryCondition(scope.AddToVars(value))
|
||||
} else {
|
||||
str = fmt.Sprintf("(%v)", value)
|
||||
}
|
||||
}
|
||||
case int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, sql.NullInt64:
|
||||
return scope.primaryCondition(scope.AddToVars(value))
|
||||
|
Loading…
x
Reference in New Issue
Block a user