* Creates an INSERT query with the given data. * * @example * ```ts * await em.createQueryBuilder(User) * .insert({ name: 'John', email: 'john@example.com' }) * .execute(); * * // Bulk insert * await em.createQueryBuilder(User) * .insert([{ name: 'John' }, { name:
(
data: RequiredEntityData<Entity> | RequiredEntityData<Entity>[],
)
| 871 | * ``` |
| 872 | */ |
| 873 | insert( |
| 874 | data: RequiredEntityData<Entity> | RequiredEntityData<Entity>[], |
| 875 | ): InsertQueryBuilder<Entity, RootAlias, Context> { |
| 876 | return this.init(QueryType.INSERT, data) as unknown as InsertQueryBuilder<Entity, RootAlias, Context>; |
| 877 | } |
| 878 | |
| 879 | /** |
| 880 | * Creates an INSERT ... SELECT query that copies rows from the source query. |