ICommandRepository
Defined in: packages/ddd-core/application/ports/command-repository.port.ts:21
Contract for write-side command repositories.
Persists an entity or aggregate state into persistence storage.
Example
Section titled “Example”constructor( @Inject(COMMAND_REPOSITORY.createUser) private readonly users: ICommandRepository<User, UserSnapshot>,) {}
await this.users.save(user);Extended by
Section titled “Extended by”Type Parameters
Section titled “Type Parameters”TEntity
Section titled “TEntity”TEntity = unknown
The aggregate entity or payload being persisted.
TResult
Section titled “TResult”TResult = unknown
The result type returned after persistence (or null on deletion).
Methods
Section titled “Methods”save()
Section titled “save()”save(
entity):Promise<TResult|null>
Defined in: packages/ddd-core/application/ports/command-repository.port.ts:28
Persists the aggregate/payload.
Returning null is the conventional deletion result used by the DDD cache
decorator to trigger eviction/barrier behavior.
Parameters
Section titled “Parameters”entity
Section titled “entity”TEntity
Returns
Section titled “Returns”Promise<TResult | null>