Merge branch 'master' into master
This commit is contained in:
commit
1750598501
@ -368,6 +368,7 @@ func (association *Association) saveAssociations(values ...interface{}) *Associa
|
|||||||
return association
|
return association
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// setErr set error when the error is not nil. And return Association.
|
||||||
func (association *Association) setErr(err error) *Association {
|
func (association *Association) setErr(err error) *Association {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
association.Error = err
|
association.Error = err
|
||||||
|
4
scope.go
4
scope.go
@ -68,7 +68,7 @@ func (scope *Scope) Dialect() Dialect {
|
|||||||
|
|
||||||
// Quote used to quote string to escape them for database
|
// Quote used to quote string to escape them for database
|
||||||
func (scope *Scope) Quote(str string) string {
|
func (scope *Scope) Quote(str string) string {
|
||||||
if strings.Index(str, ".") != -1 {
|
if strings.Contains(str, ".") {
|
||||||
newStrs := []string{}
|
newStrs := []string{}
|
||||||
for _, str := range strings.Split(str, ".") {
|
for _, str := range strings.Split(str, ".") {
|
||||||
newStrs = append(newStrs, scope.Dialect().Quote(str))
|
newStrs = append(newStrs, scope.Dialect().Quote(str))
|
||||||
@ -330,7 +330,7 @@ func (scope *Scope) TableName() string {
|
|||||||
// QuotedTableName return quoted table name
|
// QuotedTableName return quoted table name
|
||||||
func (scope *Scope) QuotedTableName() (name string) {
|
func (scope *Scope) QuotedTableName() (name string) {
|
||||||
if scope.Search != nil && len(scope.Search.tableName) > 0 {
|
if scope.Search != nil && len(scope.Search.tableName) > 0 {
|
||||||
if strings.Index(scope.Search.tableName, " ") != -1 {
|
if strings.Contains(scope.Search.tableName, " ") {
|
||||||
return scope.Search.tableName
|
return scope.Search.tableName
|
||||||
}
|
}
|
||||||
return scope.Quote(scope.Search.tableName)
|
return scope.Quote(scope.Search.tableName)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user