Skip to content

@joakimbugge/typeorm-seeder


@joakimbugge/typeorm-seeder / MultiSeed

Interface: MultiSeed<T>

Defined in: seed/builder.ts:32

Seed builder for multiple entity classes. Returned by seed when passed an array. Each method returns a tuple of instances in the same order as the input array. Relation seeding is disabled by default; pass relations: true in the context to enable it.

Type Parameters

T

T extends readonly EntityConstructor[]

Methods

create()

ts
create(context?): Promise<MapToInstances<T>>;

Defined in: seed/builder.ts:34

Creates one instance of each class in memory without persisting.

Parameters

context?

SeedContext

Returns

Promise<MapToInstances<T>>


createMany()

ts
createMany(count, context?): Promise<MapToInstanceArrays<T>>;

Defined in: seed/builder.ts:38

Creates count instances of each class in memory without persisting.

Parameters

count

number

context?

SeedContext

Returns

Promise<MapToInstanceArrays<T>>


save()

ts
save(options): Promise<MapToInstances<T>>;

Defined in: seed/builder.ts:36

Creates and persists one instance of each class.

Parameters

options

SaveOptions

Returns

Promise<MapToInstances<T>>


saveMany()

ts
saveMany(count, options): Promise<MapToInstanceArrays<T>>;

Defined in: seed/builder.ts:40

Creates and persists count instances of each class.

Parameters

count

number

options

SaveOptions

Returns

Promise<MapToInstanceArrays<T>>

Released under the MIT License.