mirror of
https://github.com/ent/ent.git
synced 2026-04-28 13:40:56 +03:00
dialect/sql/sqlgraph: allow update single node without select
This commit is contained in:
committed by
Ariel Mashraki
parent
82277ac804
commit
712b6a5f08
@@ -671,6 +671,11 @@ func (u *updater) node(ctx context.Context, tx dialect.ExecQuerier) error {
|
||||
if err := u.setExternalEdges(ctx, []driver.Value{id}, addEdges, clearEdges); err != nil {
|
||||
return err
|
||||
}
|
||||
// Ignore querying the database when there's nothing
|
||||
// to scan into it.
|
||||
if u.ScanValues == nil {
|
||||
return nil
|
||||
}
|
||||
selector := u.builder.Select(u.Node.Columns...).
|
||||
From(u.builder.Table(u.Node.Table).Schema(u.Node.Schema)).
|
||||
Where(sql.EQ(u.Node.ID.Column, u.Node.ID.Value))
|
||||
|
||||
Reference in New Issue
Block a user