MCPcopy
hub / github.com/ent/ent / batchInsert

Method batchInsert

dialect/sql/sqlgraph/graph.go:1601–1604  ·  view source on GitHub ↗

batchInsert inserts a batch of nodes to their table and sets their ID if it was not provided by the user.

(ctx context.Context, tx dialect.ExecQuerier, insert *sql.InsertBuilder)

Source from the content-addressed store, hash-verified

1599
1600// batchInsert inserts a batch of nodes to their table and sets their ID if it was not provided by the user.
1601func (c *batchCreator) batchInsert(ctx context.Context, tx dialect.ExecQuerier, insert *sql.InsertBuilder) error {
1602 c.ensureConflict(insert)
1603 return c.insertLastIDs(ctx, tx, insert.Returning(c.Nodes[0].ID.Column))
1604}
1605
1606// ensureConflict ensures the ON CONFLICT is added to the insert statement.
1607func (c *batchCreator) ensureConflict(insert *sql.InsertBuilder) {

Callers 1

nodesMethod · 0.95

Calls 3

ensureConflictMethod · 0.95
insertLastIDsMethod · 0.95
ReturningMethod · 0.45

Tested by

no test coverage detected