Skip to content

@joakimbugge/seeder


@joakimbugge/seeder / PersistenceAdapter

Interface: PersistenceAdapter<TContext> ​

Defined in: packages/seeder/src/seed/adapter.ts:43

ORM-specific persistence provider injected into the save pipeline. Each ORM package implements this interface to persist entities using its own connection and flush mechanism without coupling the base package to any ORM.

TContext is the ORM-specific context type that carries the connection (e.g. { dataSource: DataSource } for TypeORM, { em: EntityManager } for MikroORM).

Type Parameters ​

TContext ​

TContext extends SeedContext = SeedContext

Methods ​

save() ​

ts
save<T>(
   EntityClass, 
   entities, 
context): Promise<T[]>;

Defined in: packages/seeder/src/seed/adapter.ts:48

Persists the given pre-created entities and returns the saved instances. The context contains the ORM connection and any other seed context fields.

Type Parameters ​

T ​

T extends object

Parameters ​

EntityClass ​

EntityConstructor<T>

entities ​

T[]

context ​

TContext

Returns ​

Promise<T[]>

Released under the MIT License.