addNew

open suspend override fun addNew(obj: BusinessObject): Either<StoreError, BusinessObject>

Creates a new copy of the BusinessObject with a new id and stores it in this BusinessObjectStore.

Return

A copy of the obj with the new id if it was successfully added

A DuplicateRecordError if the obj already exists in this EventStore (based on obj.id)

A StoreError if the obj could not be appended

Parameters

obj

The BusinessObject to store.