@half0wl/container / ContainerConfig
Interface: ContainerConfig<TDeps>
Defined in: base.ts:40
Configuration object for Container.create.
Type Parameters
| Type Parameter | Description |
|---|---|
TDeps | User-defined dependency interface |
Properties
deps?
ts
optional deps: TDeps;Defined in: base.ts:42
The user-defined dependencies to inject into services.
trace?
ts
optional trace: TraceFn;Defined in: base.ts:60
Optional tracing function for services decorated with @Service({ trace: true }). When a traced service is resolved, all its methods are wrapped with this function.
Param
The span name in ClassName.methodName format
Param
The original method to execute within the span
Returns
The return value of fn
Example
ts
const container = Container.create<ContainerDeps>({
deps: { db, logger },
trace: (spanName, fn) => tracer.startActiveSpan(spanName, () => fn()),
});