@joakimbugge/mikroorm-seeder / SeedFactory
Type Alias: SeedFactory<T, TEntity>
ts
type SeedFactory<T, TEntity> = (context, self, index) => T | Promise<T>;Defined in: seed/registry.ts:34
Factory callback passed to @Seed. Receives the seed context, the partially built entity, and a zero-based index that counts up across a createMany/saveMany batch.
Properties are seeded sequentially in declaration order, so any property declared above the current one is already set on self and can be read to derive the current value.
Type Parameters
T
T = unknown
TEntity
TEntity = any
Parameters
context
self
TEntity
index
number
Returns
T | Promise<T>
Example
ts
@Seed((_, __, i) => `user-${i}@example.com`)
email!: string