$ open source · GPL-3.0 — need a commercial license? imqueue.com →

query.createEntity() function

Recursively creates entity and all it's relations from a given input using a given model.

Signature:

export function createEntity<T extends BaseModel<T>, I>(model: typeof BaseModel, input: I, fields?: FieldsInput, transaction?: Transaction): Promise<Partial<T>>;

Parameters

Parameter

Type

Description

model

typeof BaseModel

model class to map entity to

input

I

data input object related to a given model

fields

FieldsInput

(Optional) fields map to return on created entity

transaction

Transaction

(Optional) transaction

Returns:

Promise<Partial<T>>