_entities_base_entity_.baseentity - jellyfishsolutions/lynx GitHub Wiki

lynx-framework

Globals / "entities/base.entity" / BaseEntity

Class: BaseEntity

Hierarchy

Index

Properties

Methods

Properties

createdAt

createdAt: Date

Defined in lynx/entities/base.entity.ts:8


hiddenFields

hiddenFields: string[] = []

Defined in lynx/entities/base.entity.ts:11


updatedAt

updatedAt: Date

Defined in lynx/entities/base.entity.ts:9


target

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.

Methods

addHiddenField

addHiddenField(field: string): void

Defined in lynx/entities/base.entity.ts:23

Parameters:

Name Type
field string

Returns: void


hasId

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

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.

Parameters:

Name Type
options? SaveOptions

Returns: Promise<this>


reload

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

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.

Parameters:

Name Type
options? RemoveOptions

Returns: Promise<this>


removeHiddenField

removeHiddenField(field: string): void

Defined in lynx/entities/base.entity.ts:13

Parameters:

Name Type
field string

Returns: void


save

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.

Parameters:

Name Type
options? SaveOptions

Returns: Promise<this>


serialize

serialize(): any

Defined in lynx/entities/base.entity.ts:34

Returns: any


softRemove

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.

Parameters:

Name Type
options? SaveOptions

Returns: Promise<this>


clear

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).

Type parameters:

Name Type
T BaseEntity

Parameters:

Name Type
this ObjectType<T>

Returns: Promise<void>


count

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.

Type parameters:

Name Type
T BaseEntity

Parameters:

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.

Type parameters:

Name Type
T BaseEntity

Parameters:

Name Type
this ObjectType<T>
conditions? FindConditions<T>

Returns: Promise<number>


create

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.

Type parameters:

Name Type
T BaseEntity

Parameters:

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.

Type parameters:

Name Type
T BaseEntity

Parameters:

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.

Type parameters:

Name Type
T BaseEntity

Parameters:

Name Type
this ObjectType<T>
entityLike DeepPartial<T>

Returns: T


createQueryBuilder

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.

Type parameters:

Name Type
T BaseEntity

Parameters:

Name Type
this ObjectType<T>
alias? undefined | string

Returns: SelectQueryBuilder<T>


delete

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.

Type parameters:

Name Type
T BaseEntity

Parameters:

Name Type
this ObjectType<T>
criteria string | string[] | number | number[] | Date | Date[] | ObjectID | ObjectID[] | FindConditions<T>
options? RemoveOptions

Returns: Promise<DeleteResult>


find

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.

Type parameters:

Name Type
T BaseEntity

Parameters:

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.

Type parameters:

Name Type
T BaseEntity

Parameters:

Name Type
this ObjectType<T>
conditions? FindConditions<T>

Returns: Promise<T[]>


findAndCount

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).

Type parameters:

Name Type
T BaseEntity

Parameters:

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).

Type parameters:

Name Type
T BaseEntity

Parameters:

Name Type
this ObjectType<T>
conditions? FindConditions<T>

Returns: Promise<[T[], number]>


findByIds

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.

Type parameters:

Name Type
T BaseEntity

Parameters:

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.

Type parameters:

Name Type
T BaseEntity

Parameters:

Name Type
this ObjectType<T>
ids any[]
conditions? FindConditions<T>

Returns: Promise<T[]>


findOne

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.

Type parameters:

Name Type
T BaseEntity

Parameters:

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.

Type parameters:

Name Type
T BaseEntity

Parameters:

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.

Type parameters:

Name Type
T BaseEntity

Parameters:

Name Type
this ObjectType<T>
conditions? FindConditions<T>
options? FindOneOptions<T>

Returns: Promise<T | undefined>


findOneOrFail

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.

Type parameters:

Name Type
T BaseEntity

Parameters:

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.

Type parameters:

Name Type
T BaseEntity

Parameters:

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.

Type parameters:

Name Type
T BaseEntity

Parameters:

Name Type
this ObjectType<T>
conditions? FindConditions<T>
options? FindOneOptions<T>

Returns: Promise<T>


getId

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.

Type parameters:

Name Type
T BaseEntity

Parameters:

Name Type
this ObjectType<T>
entity T

Returns: any


getRepository

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.

Type parameters:

Name Type
T BaseEntity

Parameters:

Name Type
this ObjectType<T>

Returns: Repository<T>


hasId

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.

Parameters:

Name Type
entity BaseEntity

Returns: boolean


insert

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.

Type parameters:

Name Type
T BaseEntity

Parameters:

Name Type
this ObjectType<T>
entity QueryDeepPartialEntity<T> | QueryDeepPartialEntity<T>[]
options? SaveOptions

Returns: Promise<InsertResult>


merge

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.

Type parameters:

Name Type
T BaseEntity

Parameters:

Name Type
this ObjectType<T>
mergeIntoEntity T
...entityLikes DeepPartial<T>[]

Returns: T


preload

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.

Type parameters:

Name Type
T BaseEntity

Parameters:

Name Type
this ObjectType<T>
entityLike DeepPartial<T>

Returns: Promise<T | undefined>


query

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).

Type parameters:

Name Type
T BaseEntity

Parameters:

Name Type
this ObjectType<T>
query string
parameters? any[]

Returns: Promise<any>


remove

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.

Type parameters:

Name Type
T BaseEntity

Parameters:

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.

Type parameters:

Name Type
T BaseEntity

Parameters:

Name Type
this ObjectType<T>
entity T
options? RemoveOptions

Returns: Promise<T>


save

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.

Type parameters:

Name Type
T BaseEntity

Parameters:

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.

Type parameters:

Name Type
T BaseEntity

Parameters:

Name Type
this ObjectType<T>
entity T
options? SaveOptions

Returns: Promise<T>


softRemove

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.

Type parameters:

Name Type
T BaseEntity

Parameters:

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.

Type parameters:

Name Type
T BaseEntity

Parameters:

Name Type
this ObjectType<T>
entity T
options? SaveOptions

Returns: Promise<T>


update

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.

Type parameters:

Name Type
T BaseEntity

Parameters:

Name Type
this ObjectType<T>
criteria string | string[] | number | number[] | Date | Date[] | ObjectID | ObjectID[] | FindConditions<T>
partialEntity QueryDeepPartialEntity<T>
options? SaveOptions

Returns: Promise<UpdateResult>


useConnection

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.

Parameters:

Name Type
connection Connection

Returns: void

⚠️ **GitHub.com Fallback** ⚠️