dialect/sql/sqlgraph: use correct column when querying m2o/o2o edges (#629)

Fixed #621
This commit is contained in:
Ariel Mashraki
2020-07-21 10:21:51 +03:00
committed by GitHub
parent 7425b90e01
commit 3b77e5d71a
4 changed files with 5 additions and 4 deletions

View File

@@ -164,7 +164,7 @@ func Neighbors(dialect string, s *Step) (q *sql.Selector) {
q = builder.Select().
From(t1).
Join(t2).
On(t1.C(s.From.Column), t2.C(s.Edge.Columns[0]))
On(t1.C(s.To.Column), t2.C(s.Edge.Columns[0]))
case r == O2M || (r == O2O && !s.Edge.Inverse):
q = builder.Select().
From(builder.Table(s.To.Table)).