静态targetReturns object that is managed by this repository. If this repository manages entity from schema, then it returns a name of that schema instead.
Checks if entity has an id. If entity composite compose ids, it will check them all.
Reloads entity data from the database.
Saves current entity in the database. If entity does not exist in the database then inserts, otherwise updates.
可选options: SaveOptions静态averageReturn the AVG of a column
静态clearClears all the data from the given table/collection (truncates/drops it).
静态countCounts entities that match given options.
可选options: FindManyOptions<T>静态countCounts entities that match given WHERE conditions.
静态createCreates 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.
静态createCreates a new query builder that can be used to build a SQL query.
可选alias: string静态deleteDeletes 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.
静态existsChecks whether any entity exists that matches the given options.
可选options: FindManyOptions<T>静态existsChecks whether any entity exists that matches the given conditions.
静态findFinds entities that match given options.
可选options: FindManyOptions<T>静态findFinds entities that match given find options. Also counts all entities that match given conditions, but ignores pagination settings (from and take options).
可选options: FindManyOptions<T>静态findFinds entities that match given WHERE conditions. Also counts all entities that match given conditions, but ignores pagination settings (from and take options).
静态findFinds entities that match given WHERE conditions.
静态findFinds entities by ids. Optionally find options can be applied.
静态findFinds first entity that matches given conditions.
静态findFinds first entity that matches given conditions.
静态findFinds first entity that matches given options.
静态findFinds first entity that matches given conditions.
静态findFinds first entity that matches given conditions.
静态getGets entity mixed id.
静态getGets current entity's Repository.
静态hasChecks entity has an id. If entity composite compose ids, it will check them all.
静态insertInserts 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.
静态maximumReturn the MAX of a column
静态mergeMerges multiple entities (or entity-like objects) into a given entity.
静态minimumReturn the MIN of a column
静态preloadCreates 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.
静态queryExecutes a raw SQL query and returns a raw database results. Raw query execution is supported only by relational databases (MongoDB is not supported).
可选parameters: any[]静态removeRemoves a given entities from the database.
可选options: RemoveOptionsRemoves a given entity from the database.
可选options: RemoveOptions静态saveSaves all given entities in the database. If entities do not exist in the database then inserts, otherwise updates.
可选options: SaveOptionsSaves a given entity in the database. If entity does not exist in the database then inserts, otherwise updates.
可选options: SaveOptions静态softRecords the delete date of all given entities.
可选options: SaveOptionsRecords the delete date of a given entity.
可选options: SaveOptions静态sumReturn the SUM of a column
静态updateUpdates 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.
静态upsertInserts a given entity into the database, unless a unique constraint conflicts then updates the entity Unlike save method executes a primitive operation without cascades, relations and other operations included. Executes fast and efficient INSERT ... ON CONFLICT DO UPDATE/ON DUPLICATE KEY UPDATE query.
静态use
Base abstract entity for all entities, used in ActiveRecord patterns.