mirror of https://github.com/go-gorm/gorm.git
Add QueryFields mode when query many2many relations
This commit is contained in:
parent
59730417aa
commit
ad8a5c0d1a
|
@ -470,7 +470,7 @@ func (association *Association) buildCondition() *DB {
|
|||
tx.Clauses(clause.Expr{SQL: strings.Replace(joinStmt.SQL.String(), "WHERE ", "", 1), Vars: joinStmt.Vars})
|
||||
}
|
||||
|
||||
tx.Clauses(clause.From{Joins: []clause.Join{{
|
||||
tx = tx.Session(&Session{QueryFields: true}).Clauses(clause.From{Joins: []clause.Join{{
|
||||
Table: clause.Table{Name: association.Relationship.JoinTable.Table},
|
||||
ON: clause.Where{Exprs: queryConds},
|
||||
}}})
|
||||
|
|
|
@ -8,10 +8,10 @@ require (
|
|||
github.com/lib/pq v1.6.0
|
||||
github.com/stretchr/testify v1.5.1
|
||||
gorm.io/driver/mysql v1.0.3
|
||||
gorm.io/driver/postgres v1.0.5
|
||||
gorm.io/driver/postgres v1.0.6
|
||||
gorm.io/driver/sqlite v1.1.4
|
||||
gorm.io/driver/sqlserver v1.0.5
|
||||
gorm.io/gorm v1.20.7
|
||||
gorm.io/gorm v1.20.8
|
||||
)
|
||||
|
||||
replace gorm.io/gorm => ../
|
||||
|
|
Loading…
Reference in New Issue