_entities_base_entity_.baseentity - jellyfishsolutions/lynx GitHub Wiki
Globals / "entities/base.entity" / BaseEntity
- addHiddenField
- hasId
- recover
- reload
- remove
- removeHiddenField
- save
- serialize
- softRemove
- clear
- count
- create
- createQueryBuilder
- delete
- find
- findAndCount
- findByIds
- findOne
- findOneOrFail
- getId
- getRepository
- hasId
- insert
- merge
- preload
- query
- remove
- save
- softRemove
- update
- useConnection
• createdAt: Date
Defined in lynx/entities/base.entity.ts:8
hiddenFields
• hiddenFields: string[] = []
Defined in lynx/entities/base.entity.ts:11
• updatedAt: Date
Defined in lynx/entities/base.entity.ts:9
▪ Static Readonly target: Function | string
Inherited from BaseEntity.target
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:63
Returns object that is managed by this repository. If this repository manages entity from schema, then it returns a name of that schema instead.
addHiddenField
▸ addHiddenField(field: string): void
Defined in lynx/entities/base.entity.ts:23
| Name | Type |
|---|---|
field |
string |
Returns: void
▸ hasId(): boolean
Inherited from BaseEntity.hasId
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:28
Checks if entity has an id. If entity composite compose ids, it will check them all.
Returns: boolean
▸ recover(options?: SaveOptions): Promise<this>
Inherited from BaseEntity.recover
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:45
Recovers a given entity in the database.
| Name | Type |
|---|---|
options? |
SaveOptions |
Returns: Promise<this>
▸ reload(): Promise<void>
Inherited from BaseEntity.reload
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:49
Reloads entity data from the database.
Returns: Promise<void>
▸ remove(options?: RemoveOptions): Promise<this>
Inherited from BaseEntity.remove
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:37
Removes current entity from the database.
| Name | Type |
|---|---|
options? |
RemoveOptions |
Returns: Promise<this>
removeHiddenField
▸ removeHiddenField(field: string): void
Defined in lynx/entities/base.entity.ts:13
| Name | Type |
|---|---|
field |
string |
Returns: void
▸ save(options?: SaveOptions): Promise<this>
Inherited from BaseEntity.save
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:33
Saves current entity in the database. If entity does not exist in the database then inserts, otherwise updates.
| Name | Type |
|---|---|
options? |
SaveOptions |
Returns: Promise<this>
▸ serialize(): any
Defined in lynx/entities/base.entity.ts:34
Returns: any
▸ softRemove(options?: SaveOptions): Promise<this>
Inherited from BaseEntity.softRemove
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:41
Records the delete date of current entity.
| Name | Type |
|---|---|
options? |
SaveOptions |
Returns: Promise<this>
▸ Staticclear<T>(this: ObjectType<T>): Promise<void>
Inherited from BaseEntity.clear
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:222
Clears all the data from the given table/collection (truncates/drops it).
| Name | Type |
|---|---|
T |
BaseEntity |
| Name | Type |
|---|---|
this |
ObjectType<T> |
Returns: Promise<void>
▸ Staticcount<T>(this: ObjectType<T>, options?: FindManyOptions<T>): Promise<number>
Inherited from BaseEntity.count
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:155
Counts entities that match given options.
| Name | Type |
|---|---|
T |
BaseEntity |
| Name | Type |
|---|---|
this |
ObjectType<T> |
options? |
FindManyOptions<T> |
Returns: Promise<number>
▸ Staticcount<T>(this: ObjectType<T>, conditions?: FindConditions<T>): Promise<number>
Inherited from BaseEntity.count
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:159
Counts entities that match given conditions.
| Name | Type |
|---|---|
T |
BaseEntity |
| Name | Type |
|---|---|
this |
ObjectType<T> |
conditions? |
FindConditions<T> |
Returns: Promise<number>
▸ Staticcreate<T>(this: ObjectType<T>): T
Inherited from BaseEntity.create
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:80
Creates a new entity instance.
| Name | Type |
|---|---|
T |
BaseEntity |
| Name | Type |
|---|---|
this |
ObjectType<T> |
Returns: T
▸ Staticcreate<T>(this: ObjectType<T>, entityLikeArray: DeepPartial<T>[]): T[]
Inherited from BaseEntity.create
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:85
Creates a new entities and copies all entity properties from given objects into their new entities. Note that it copies only properties that present in entity schema.
| Name | Type |
|---|---|
T |
BaseEntity |
| Name | Type |
|---|---|
this |
ObjectType<T> |
entityLikeArray |
DeepPartial<T>[] |
Returns: T[]
▸ Staticcreate<T>(this: ObjectType<T>, entityLike: DeepPartial<T>): T
Inherited from BaseEntity.create
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:90
Creates a new entity instance and copies all entity properties from this object into a new entity. Note that it copies only properties that present in entity schema.
| Name | Type |
|---|---|
T |
BaseEntity |
| Name | Type |
|---|---|
this |
ObjectType<T> |
entityLike |
DeepPartial<T> |
Returns: T
▸ StaticcreateQueryBuilder<T>(this: ObjectType<T>, alias?: undefined | string): SelectQueryBuilder<T>
Inherited from BaseEntity.createQueryBuilder
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:76
Creates a new query builder that can be used to build a sql query.
| Name | Type |
|---|---|
T |
BaseEntity |
| Name | Type |
|---|---|
this |
ObjectType<T> |
alias? |
undefined | string |
Returns: SelectQueryBuilder<T>
▸ Staticdelete<T>(this: ObjectType<T>, criteria: string | string[] | number | number[] | Date | Date[] | ObjectID | ObjectID[] | FindConditions<T>, options?: RemoveOptions): Promise<DeleteResult>
Inherited from BaseEntity.delete
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:151
Deletes entities by a given criteria. Unlike remove method executes a primitive operation without cascades, relations and other operations included. Executes fast and efficient DELETE query. Does not check if entity exist in the database.
| Name | Type |
|---|---|
T |
BaseEntity |
| Name | Type |
|---|---|
this |
ObjectType<T> |
criteria |
string | string[] | number | number[] | Date | Date[] | ObjectID | ObjectID[] | FindConditions<T> |
options? |
RemoveOptions |
Returns: Promise<DeleteResult>
▸ Staticfind<T>(this: ObjectType<T>, options?: FindManyOptions<T>): Promise<T[]>
Inherited from BaseEntity.find
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:163
Finds entities that match given options.
| Name | Type |
|---|---|
T |
BaseEntity |
| Name | Type |
|---|---|
this |
ObjectType<T> |
options? |
FindManyOptions<T> |
Returns: Promise<T[]>
▸ Staticfind<T>(this: ObjectType<T>, conditions?: FindConditions<T>): Promise<T[]>
Inherited from BaseEntity.find
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:167
Finds entities that match given conditions.
| Name | Type |
|---|---|
T |
BaseEntity |
| Name | Type |
|---|---|
this |
ObjectType<T> |
conditions? |
FindConditions<T> |
Returns: Promise<T[]>
▸ StaticfindAndCount<T>(this: ObjectType<T>, options?: FindManyOptions<T>): Promise<[T[], number]>
Inherited from BaseEntity.findAndCount
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:173
Finds entities that match given find options. Also counts all entities that match given conditions, but ignores pagination settings (from and take options).
| Name | Type |
|---|---|
T |
BaseEntity |
| Name | Type |
|---|---|
this |
ObjectType<T> |
options? |
FindManyOptions<T> |
Returns: Promise<[T[], number]>
▸ StaticfindAndCount<T>(this: ObjectType<T>, conditions?: FindConditions<T>): Promise<[T[], number]>
Inherited from BaseEntity.findAndCount
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:179
Finds entities that match given conditions. Also counts all entities that match given conditions, but ignores pagination settings (from and take options).
| Name | Type |
|---|---|
T |
BaseEntity |
| Name | Type |
|---|---|
this |
ObjectType<T> |
conditions? |
FindConditions<T> |
Returns: Promise<[T[], number]>
▸ StaticfindByIds<T>(this: ObjectType<T>, ids: any[], options?: FindManyOptions<T>): Promise<T[]>
Inherited from BaseEntity.findByIds
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:184
Finds entities by ids. Optionally find options can be applied.
| Name | Type |
|---|---|
T |
BaseEntity |
| Name | Type |
|---|---|
this |
ObjectType<T> |
ids |
any[] |
options? |
FindManyOptions<T> |
Returns: Promise<T[]>
▸ StaticfindByIds<T>(this: ObjectType<T>, ids: any[], conditions?: FindConditions<T>): Promise<T[]>
Inherited from BaseEntity.findByIds
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:189
Finds entities by ids. Optionally conditions can be applied.
| Name | Type |
|---|---|
T |
BaseEntity |
| Name | Type |
|---|---|
this |
ObjectType<T> |
ids |
any[] |
conditions? |
FindConditions<T> |
Returns: Promise<T[]>
▸ StaticfindOne<T>(this: ObjectType<T>, id?: string | number | Date | ObjectID, options?: FindOneOptions<T>): Promise<T | undefined>
Inherited from BaseEntity.findOne
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:193
Finds first entity that matches given options.
| Name | Type |
|---|---|
T |
BaseEntity |
| Name | Type |
|---|---|
this |
ObjectType<T> |
id? |
string | number | Date | ObjectID |
options? |
FindOneOptions<T> |
Returns: Promise<T | undefined>
▸ StaticfindOne<T>(this: ObjectType<T>, options?: FindOneOptions<T>): Promise<T | undefined>
Inherited from BaseEntity.findOne
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:197
Finds first entity that matches given options.
| Name | Type |
|---|---|
T |
BaseEntity |
| Name | Type |
|---|---|
this |
ObjectType<T> |
options? |
FindOneOptions<T> |
Returns: Promise<T | undefined>
▸ StaticfindOne<T>(this: ObjectType<T>, conditions?: FindConditions<T>, options?: FindOneOptions<T>): Promise<T | undefined>
Inherited from BaseEntity.findOne
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:201
Finds first entity that matches given conditions.
| Name | Type |
|---|---|
T |
BaseEntity |
| Name | Type |
|---|---|
this |
ObjectType<T> |
conditions? |
FindConditions<T> |
options? |
FindOneOptions<T> |
Returns: Promise<T | undefined>
▸ StaticfindOneOrFail<T>(this: ObjectType<T>, id?: string | number | Date | ObjectID, options?: FindOneOptions<T>): Promise<T>
Inherited from BaseEntity.findOneOrFail
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:205
Finds first entity that matches given options.
| Name | Type |
|---|---|
T |
BaseEntity |
| Name | Type |
|---|---|
this |
ObjectType<T> |
id? |
string | number | Date | ObjectID |
options? |
FindOneOptions<T> |
Returns: Promise<T>
▸ StaticfindOneOrFail<T>(this: ObjectType<T>, options?: FindOneOptions<T>): Promise<T>
Inherited from BaseEntity.findOneOrFail
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:209
Finds first entity that matches given options.
| Name | Type |
|---|---|
T |
BaseEntity |
| Name | Type |
|---|---|
this |
ObjectType<T> |
options? |
FindOneOptions<T> |
Returns: Promise<T>
▸ StaticfindOneOrFail<T>(this: ObjectType<T>, conditions?: FindConditions<T>, options?: FindOneOptions<T>): Promise<T>
Inherited from BaseEntity.findOneOrFail
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:213
Finds first entity that matches given conditions.
| Name | Type |
|---|---|
T |
BaseEntity |
| Name | Type |
|---|---|
this |
ObjectType<T> |
conditions? |
FindConditions<T> |
options? |
FindOneOptions<T> |
Returns: Promise<T>
▸ StaticgetId<T>(this: ObjectType<T>, entity: T): any
Inherited from BaseEntity.getId
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:72
Gets entity mixed id.
| Name | Type |
|---|---|
T |
BaseEntity |
| Name | Type |
|---|---|
this |
ObjectType<T> |
entity |
T |
Returns: any
▸ StaticgetRepository<T>(this: ObjectType<T>): Repository<T>
Inherited from BaseEntity.getRepository
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:57
Gets current entity's Repository.
| Name | Type |
|---|---|
T |
BaseEntity |
| Name | Type |
|---|---|
this |
ObjectType<T> |
Returns: Repository<T>
▸ StatichasId(entity: BaseEntity): boolean
Inherited from BaseEntity.hasId
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:68
Checks entity has an id. If entity composite compose ids, it will check them all.
| Name | Type |
|---|---|
entity |
BaseEntity |
Returns: boolean
▸ Staticinsert<T>(this: ObjectType<T>, entity: QueryDeepPartialEntity<T> | QueryDeepPartialEntity<T>[], options?: SaveOptions): Promise<InsertResult>
Inherited from BaseEntity.insert
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:137
Inserts a given entity into the database. Unlike save method executes a primitive operation without cascades, relations and other operations included. Executes fast and efficient INSERT query. Does not check if entity exist in the database, so query will fail if duplicate entity is being inserted.
| Name | Type |
|---|---|
T |
BaseEntity |
| Name | Type |
|---|---|
this |
ObjectType<T> |
entity |
QueryDeepPartialEntity<T> | QueryDeepPartialEntity<T>[] |
options? |
SaveOptions |
Returns: Promise<InsertResult>
▸ Staticmerge<T>(this: ObjectType<T>, mergeIntoEntity: T, ...entityLikes: DeepPartial<T>[]): T
Inherited from BaseEntity.merge
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:94
Merges multiple entities (or entity-like objects) into a given entity.
| Name | Type |
|---|---|
T |
BaseEntity |
| Name | Type |
|---|---|
this |
ObjectType<T> |
mergeIntoEntity |
T |
...entityLikes |
DeepPartial<T>[] |
Returns: T
▸ Staticpreload<T>(this: ObjectType<T>, entityLike: DeepPartial<T>): Promise<T | undefined>
Inherited from BaseEntity.preload
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:104
Creates a new entity from the given plain 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.
| Name | Type |
|---|---|
T |
BaseEntity |
| Name | Type |
|---|---|
this |
ObjectType<T> |
entityLike |
DeepPartial<T> |
Returns: Promise<T | undefined>
▸ Staticquery<T>(this: ObjectType<T>, query: string, parameters?: any[]): Promise<any>
Inherited from BaseEntity.query
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:218
Executes a raw SQL query and returns a raw database results. Raw query execution is supported only by relational databases (MongoDB is not supported).
| Name | Type |
|---|---|
T |
BaseEntity |
| Name | Type |
|---|---|
this |
ObjectType<T> |
query |
string |
parameters? |
any[] |
Returns: Promise<any>
▸ Staticremove<T>(this: ObjectType<T>, entities: T[], options?: RemoveOptions): Promise<T[]>
Inherited from BaseEntity.remove
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:118
Removes a given entities from the database.
| Name | Type |
|---|---|
T |
BaseEntity |
| Name | Type |
|---|---|
this |
ObjectType<T> |
entities |
T[] |
options? |
RemoveOptions |
Returns: Promise<T[]>
▸ Staticremove<T>(this: ObjectType<T>, entity: T, options?: RemoveOptions): Promise<T>
Inherited from BaseEntity.remove
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:122
Removes a given entity from the database.
| Name | Type |
|---|---|
T |
BaseEntity |
| Name | Type |
|---|---|
this |
ObjectType<T> |
entity |
T |
options? |
RemoveOptions |
Returns: Promise<T>
▸ Staticsave<T>(this: ObjectType<T>, entities: T[], options?: SaveOptions): Promise<T[]>
Inherited from BaseEntity.save
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:109
Saves all given entities in the database. If entities do not exist in the database then inserts, otherwise updates.
| Name | Type |
|---|---|
T |
BaseEntity |
| Name | Type |
|---|---|
this |
ObjectType<T> |
entities |
T[] |
options? |
SaveOptions |
Returns: Promise<T[]>
▸ Staticsave<T>(this: ObjectType<T>, entity: T, options?: SaveOptions): Promise<T>
Inherited from BaseEntity.save
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:114
Saves a given entity in the database. If entity does not exist in the database then inserts, otherwise updates.
| Name | Type |
|---|---|
T |
BaseEntity |
| Name | Type |
|---|---|
this |
ObjectType<T> |
entity |
T |
options? |
SaveOptions |
Returns: Promise<T>
▸ StaticsoftRemove<T>(this: ObjectType<T>, entities: T[], options?: SaveOptions): Promise<T[]>
Inherited from BaseEntity.softRemove
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:126
Records the delete date of all given entities.
| Name | Type |
|---|---|
T |
BaseEntity |
| Name | Type |
|---|---|
this |
ObjectType<T> |
entities |
T[] |
options? |
SaveOptions |
Returns: Promise<T[]>
▸ StaticsoftRemove<T>(this: ObjectType<T>, entity: T, options?: SaveOptions): Promise<T>
Inherited from BaseEntity.softRemove
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:130
Records the delete date of a given entity.
| Name | Type |
|---|---|
T |
BaseEntity |
| Name | Type |
|---|---|
this |
ObjectType<T> |
entity |
T |
options? |
SaveOptions |
Returns: Promise<T>
▸ Staticupdate<T>(this: ObjectType<T>, criteria: string | string[] | number | number[] | Date | Date[] | ObjectID | ObjectID[] | FindConditions<T>, partialEntity: QueryDeepPartialEntity<T>, options?: SaveOptions): Promise<UpdateResult>
Inherited from BaseEntity.update
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:144
Updates entity partially. Entity can be found by a given conditions. Unlike save method executes a primitive operation without cascades, relations and other operations included. Executes fast and efficient UPDATE query. Does not check if entity exist in the database.
| Name | Type |
|---|---|
T |
BaseEntity |
| Name | Type |
|---|---|
this |
ObjectType<T> |
criteria |
string | string[] | number | number[] | Date | Date[] | ObjectID | ObjectID[] | FindConditions<T> |
partialEntity |
QueryDeepPartialEntity<T> |
options? |
SaveOptions |
Returns: Promise<UpdateResult>
▸ StaticuseConnection(connection: Connection): void
Inherited from BaseEntity.useConnection
Defined in node_modules/typeorm/repository/BaseEntity.d.ts:53
Sets connection to be used by entity.
| Name | Type |
|---|---|
connection |
Connection |
Returns: void