HasOneRepository
Overview
HasOneRepository is the repository for HasOne type associations.
Class Methods
find()
Finds the associated object
Signature
async find(options?: SingleRelationFindOption): Promise<Model<any> | null>
Type
Details
The query parameters are the same as Repository.find().
Example
create()
Creates an associated object
Signature
async create(options?: CreateOptions): Promise<Model>
Example
update()
Updates the associated object
Signature
async update(options: UpdateOptions): Promise<Model>
Example
remove()
Removes the associated object. This only unlinks the association, it does not delete the associated object.
Signature
async remove(options?: Transactionable): Promise<void>
Details
transaction: Transaction object. If no transaction parameter is passed, the method will automatically create an internal transaction.
Example
destroy()
Deletes the associated object
Signature
async destroy(options?: Transactionable): Promise<Boolean>
Details
transaction: Transaction object. If no transaction parameter is passed, the method will automatically create an internal transaction.
Example
set()
Sets the associated object
Signature
async set(options: TargetKey | SetOption): Promise<void>
Type
Details
tk: The targetKey of the associated object to be set.transaction: Transaction object. If no transaction parameter is passed, the method will automatically create an internal transaction.
Example

