Merge 2c7c6848c0e5a3cbd66ba07ffcd39460bf810e4e into 8a88d665d5a7c7b6a03e8cf8b6b300aa57e70be1
This commit is contained in:
commit
b548c7ffa8
6
mysql.go
6
mysql.go
@ -3,6 +3,7 @@ package gorm
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -57,6 +58,11 @@ func (mysql) SqlTag(value reflect.Value, size int, autoIncrease bool) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (mysql) Quote(key string) string {
|
func (mysql) Quote(key string) string {
|
||||||
|
if strings.Contains(key, "(") {
|
||||||
|
pos1 := strings.Index(key, "(")
|
||||||
|
pos2 := strings.Index(key, ")")
|
||||||
|
return fmt.Sprintf("`%s`(`%s`)", key[0:pos1], key[pos1+1:pos2])
|
||||||
|
}
|
||||||
return fmt.Sprintf("`%s`", key)
|
return fmt.Sprintf("`%s`", key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user