mayTx opens a new transaction if the create operation spans across multiple statements.
(ctx context.Context, drv dialect.Driver)
| 1587 | |
| 1588 | // mayTx opens a new transaction if the create operation spans across multiple statements. |
| 1589 | func (c *batchCreator) mayTx(ctx context.Context, drv dialect.Driver) (dialect.Tx, error) { |
| 1590 | for _, node := range c.Nodes { |
| 1591 | for _, edge := range node.Edges { |
| 1592 | if isExternalEdge(edge) { |
| 1593 | return drv.Tx(ctx) |
| 1594 | } |
| 1595 | } |
| 1596 | } |
| 1597 | return dialect.NopTx(drv), nil |
| 1598 | } |
| 1599 | |
| 1600 | // batchInsert inserts a batch of nodes to their table and sets their ID if it was not provided by the user. |
| 1601 | func (c *batchCreator) batchInsert(ctx context.Context, tx dialect.ExecQuerier, insert *sql.InsertBuilder) error { |
no test coverage detected