Entity Manager used by this repository.
Entity metadata of the entity current repository manages.
Query runner provider used for this repository.
Returns object that is managed by this repository. If this repository manages entity from schema, then it returns a name of that schema instead.
Clears all the data from the given table/collection (truncates/drops it).
Note: this method uses TRUNCATE and may not work as you expect in transactions on some platforms.
Counts entities that match given options.
Counts entities that match given conditions.
Gets number of ancestors of the entity.
Gets number of descendants of the entity.
Creates a new entity instance.
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.
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.
Creates a query builder used to get ancestors of the entities in the tree.
Creates a query builder used to get descendants of the entities in a tree.
Creates a new query builder that can be used to build a sql query.
Moves entity to the children of then given entity.
move(entity: Entity, to: Entity): Promise
Decrements some column by provided value of the entities matched given conditions.
Deletes entities by a given criteria. Unlike save 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.
Finds entities that match given options.
Finds entities that match given conditions.
Gets all parents (ancestors) of the given entity. Returns them all in a flat array.
Gets all parents (ancestors) of the given entity. Returns them in a tree - nested into each other.
Finds entities that match given find options. Also counts all entities that match given conditions, but ignores pagination settings (from and take options).
Finds entities that match given conditions. Also counts all entities that match given conditions, but ignores pagination settings (from and take options).
Finds entities by ids. Optionally find options can be applied.
Finds entities by ids. Optionally conditions can be applied.
Gets all children (descendants) of the given entity. Returns them all in a flat array.
Gets all children (descendants) of the given entity. Returns them in a tree - nested into each other.
Finds first entity that matches given options.
Finds first entity that matches given options.
Finds first entity that matches given conditions.
Finds first entity that matches given options.
Finds first entity that matches given options.
Finds first entity that matches given conditions.
Roots are entities that have no ancestors. Finds them all.
Gets complete trees for all roots in the table.
Gets entity mixed id.
Checks if entity has an id. If entity composite compose ids, it will check them all.
Increments some column by provided value of the entities matched given conditions.
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.
Merges multiple entities (or entity-like objects) into a given entity.
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.
Executes a raw SQL query and returns a raw database results. Raw query execution is supported only by relational databases (MongoDB is not supported).
Removes a given entities from the database.
Removes a given entity from the database.
Saves all given entities in the database. If entities do not exist in the database then inserts, otherwise updates.
Saves a given entity in the database. If entity does not exist in the database then inserts, otherwise updates.
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.
Generated using TypeDoc
Repository with additional functions to work with trees.
Repository