Updated the columnRegexp to include decimals
This commit is contained in:
parent
b16674c0f5
commit
c05d72c879
4
scope.go
4
scope.go
@ -448,7 +448,7 @@ func (scope *Scope) callMethod(methodName string, reflectValue reflect.Value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
columnRegexp = regexp.MustCompile("^[a-zA-Z]+(\\.[a-zA-Z]+)*$") // only match string like `name`, `users.name`
|
columnRegexp = regexp.MustCompile("^[a-zA-Z\\d]+(\\.[a-zA-Z\\d]+)*$") // only match string like `name`, `users.name`
|
||||||
isNumberRegexp = regexp.MustCompile("^\\s*\\d+\\s*$") // match if string is number
|
isNumberRegexp = regexp.MustCompile("^\\s*\\d+\\s*$") // match if string is number
|
||||||
comparisonRegexp = regexp.MustCompile("(?i) (=|<>|>|<|LIKE|IS|IN) ")
|
comparisonRegexp = regexp.MustCompile("(?i) (=|<>|>|<|LIKE|IS|IN) ")
|
||||||
countingQueryRegexp = regexp.MustCompile("(?i)^count(.+)$")
|
countingQueryRegexp = regexp.MustCompile("(?i)^count(.+)$")
|
||||||
@ -1143,7 +1143,7 @@ func (scope *Scope) addIndex(unique bool, indexName string, column ...string) {
|
|||||||
|
|
||||||
var columns []string
|
var columns []string
|
||||||
for _, name := range column {
|
for _, name := range column {
|
||||||
columns = append(columns, scope.Quote(name))
|
columns = append(columns, scope.quoteIfPossible(name))
|
||||||
}
|
}
|
||||||
|
|
||||||
sqlCreate := "CREATE INDEX"
|
sqlCreate := "CREATE INDEX"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user