import { type FactoryProvider } from "https://deno.land/x/deno_nest@v3.5.0/src/interfaces/mod.ts";
Interface defining a Factory type provider.
For example:
const connectionFactory = {
provide: 'CONNECTION',
useFactory: (optionsProvider: OptionsProvider) => {
const options = optionsProvider.get();
return new DatabaseConnection(options);
},
inject: [OptionsProvider],
};
Properties
provide: Provide
Injection token
useFactory: (...args: any[]) => T
Factory function that returns an instance of the provider to be injected.
Optional list of providers to be injected into the context of the Factory function.
optional
scope: ScopeOptional enum defining lifetime of the provider that is returned by the Factory function.