entc/gen: less sophisticated naming logic (#774)

Closed #772
This commit is contained in:
Ariel Mashraki
2020-09-17 09:19:55 +03:00
committed by GitHub
parent 235973cc2d
commit 17abe2d60f
225 changed files with 5542 additions and 1679 deletions

View File

@@ -403,11 +403,11 @@ func (nuo *NodeUpdateOne) Save(ctx context.Context) (*Node, error) {
// SaveX is like Save, but panics if an error occurs.
func (nuo *NodeUpdateOne) SaveX(ctx context.Context) *Node {
n, err := nuo.Save(ctx)
node, err := nuo.Save(ctx)
if err != nil {
panic(err)
}
return n
return node
}
// Exec executes the query on the entity.
@@ -423,7 +423,7 @@ func (nuo *NodeUpdateOne) ExecX(ctx context.Context) {
}
}
func (nuo *NodeUpdateOne) sqlSave(ctx context.Context) (n *Node, err error) {
func (nuo *NodeUpdateOne) sqlSave(ctx context.Context) (_node *Node, err error) {
_spec := &sqlgraph.UpdateSpec{
Node: &sqlgraph.NodeSpec{
Table: node.Table,
@@ -529,9 +529,9 @@ func (nuo *NodeUpdateOne) sqlSave(ctx context.Context) (n *Node, err error) {
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
n = &Node{config: nuo.config}
_spec.Assign = n.assignValues
_spec.ScanValues = n.scanValues()
_node = &Node{config: nuo.config}
_spec.Assign = _node.assignValues
_spec.ScanValues = _node.scanValues()
if err = sqlgraph.UpdateNode(ctx, nuo.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{node.Label}
@@ -540,5 +540,5 @@ func (nuo *NodeUpdateOne) sqlSave(ctx context.Context) (n *Node, err error) {
}
return nil, err
}
return n, nil
return _node, nil
}