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

@@ -121,7 +121,7 @@ func (nc *NodeCreate) check() error {
}
func (nc *NodeCreate) sqlSave(ctx context.Context) (*Node, error) {
n, _spec := nc.createSpec()
_node, _spec := nc.createSpec()
if err := sqlgraph.CreateNode(ctx, nc.driver, _spec); err != nil {
if cerr, ok := isSQLConstraintError(err); ok {
err = cerr
@@ -129,13 +129,13 @@ func (nc *NodeCreate) sqlSave(ctx context.Context) (*Node, error) {
return nil, err
}
id := _spec.ID.Value.(int64)
n.ID = int(id)
return n, nil
_node.ID = int(id)
return _node, nil
}
func (nc *NodeCreate) createSpec() (*Node, *sqlgraph.CreateSpec) {
var (
n = &Node{config: nc.config}
_node = &Node{config: nc.config}
_spec = &sqlgraph.CreateSpec{
Table: node.Table,
ID: &sqlgraph.FieldSpec{
@@ -150,7 +150,7 @@ func (nc *NodeCreate) createSpec() (*Node, *sqlgraph.CreateSpec) {
Value: value,
Column: node.FieldValue,
})
n.Value = value
_node.Value = value
}
if nodes := nc.mutation.ParentIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
@@ -190,7 +190,7 @@ func (nc *NodeCreate) createSpec() (*Node, *sqlgraph.CreateSpec) {
}
_spec.Edges = append(_spec.Edges, edge)
}
return n, _spec
return _node, _spec
}
// NodeCreateBulk is the builder for creating a bulk of Node entities.