-
Notifications
You must be signed in to change notification settings - Fork 2
es cqrs.EventStoreAsyncOptions
es-cqrs.EventStoreAsyncOptions
Asyncronous options for the event store
Example (useFactory): app.module.ts
@Module({
imports: [
ESCQRSModule.forRootAsync({
inject: [GlobalOptionsProvider]
useFactory: async (globalOptions: GlobalOptionsProvider) => {
return await globalOptions.getEventStoreOptions()
}
}),
MyModule,
]
})Example (useClass / useExisting): app.module.ts
class OptionsFactory implements EventStoreOptionsFactory {
public async createEventStoreOptions() {
return { logging: true }
}
}
@Module({
imports: [
ESCQRSModule.forRootAsync({
useClass: OptionsFactory
}),
MyModule,
]
})It is also possible to add additional imports for the options factory if the service required is in another module
Example (imports): app.module.ts
@Module({
imports: [
ESCQRSModule.forRootAsync({
imports: [GlobalOptionsModule]
inject: [GlobalOptionsProvider]
useFactory: async (globalOptions: GlobalOptionsProvider) => {
return await globalOptions.getEventStoreOptions()
}
}),
MyModule,
]
})-
Pick<ModuleMetadata,"imports">↳
EventStoreAsyncOptions
• Optional inject: any[]
packages/es-cqrs/src/event-store/event-store-options.ts:95
• Optional useClass: Type<EventStoreOptionsFactory>
packages/es-cqrs/src/event-store/event-store-options.ts:96
• Optional useExisting: Type<EventStoreOptionsFactory>
packages/es-cqrs/src/event-store/event-store-options.ts:97
• Optional useFactory: (...args: any[]) => EventStoreOptions | Promise<EventStoreOptions>
▸ (...args): EventStoreOptions | Promise<EventStoreOptions>
| Name | Type |
|---|---|
...args |
any[] |
EventStoreOptions | Promise<EventStoreOptions>