Skip to main content
Module

x/typeorm/src/index.ts>BaseEntity.preload

Forked from https://github.com/typeorm/typeorm
Latest
method BaseEntity.preload
import { BaseEntity } from "https://deno.land/x/typeorm@v0.2.23-rc10/src/index.ts";

Creates a new entity from the given plan javascript object. If entity already exist in the database, then it loads it (and everything related to it), replaces all values with the new ones from the given object and returns this new entity. This new entity is actually a loaded from the db entity with all properties replaced from the new object.

Note that given entity-like object must have an entity id / primary key to find entity by. Returns undefined if entity with given id was not found.

Type Parameters

T extends BaseEntity

Parameters

this: ObjectType<T>
entityLike: DeepPartial<T>

Returns

Promise<T | undefined>