typeorm APIs
- Column
- Entity
- PrimaryGeneratedColumn
- createConnection
- CreateDateColumn
- ManyToOne
- OneToMany
- UpdateDateColumn
- Repository
- JoinColumn
- QueryRunner
- Connection
- MigrationInterface
- getRepository
- getConnection
- BaseEntity
- OneToOne
- JoinTable
- PrimaryColumn
- Index
- ManyToMany
- Table
- EntityRepository
- SelectQueryBuilder
- In
- ConnectionOptions
- BeforeInsert
- Not
- getManager
- Brackets
- Unique
- TableColumn
- MoreThan
- TableForeignKey
- BeforeUpdate
- IsNull
- EntityManager
- ObjectType
- ObjectIdColumn
- RelationId
- getCustomRepository
- FindOneOptions
- MongoRepository
- ObjectID
- getConnectionManager
- DeleteDateColumn
- FindConditions
- MoreThanOrEqual
- getMongoRepository
- Generated
- DeepPartial
- LessThan
- ValueTransformer
- LessThanOrEqual
- FindManyOptions
- Like
- EntitySchema
- Raw
- VersionColumn
- AfterLoad
- DeleteResult
- EventSubscriber
- EntitySubscriberInterface
- InsertEvent
- createQueryBuilder
- createConnections
- getConnectionOptions
- DefaultNamingStrategy
- ObjectLiteral
- ILike
- Between
- Logger
- TreeRepository
- DataSource
- TableIndex
- WhereExpressionBuilder
- useContainer
- EntityTarget
- SaveOptions
- FindOperator
- ConnectionOptionsReader
- EntityMetadata
- RemoveEvent
- InsertResult
- UpdateEvent
- TreeChildren
- TreeParent
- DeleteQueryBuilder
- ChildEntity
- WhereExpression
- ViewEntity
- getMetadataArgsStorage
- OrderByCondition
- AfterInsert
- AfterUpdate
- BeforeRemove
- Timestamp
- QueryFailedError
- UpdateResult
- Equal
- UpdateQueryBuilder
- ColumnType
- ColumnOptions
- InstanceChecker
- DataSourceOptions
Other Related APIs
typeorm#DeleteQueryBuilder TypeScript Examples
The following examples show how to use
typeorm#DeleteQueryBuilder.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: base.repository.ts From Cromwell with MIT License | 6 votes |
async applyDeleteMany(qb: SelectQueryBuilder<EntityType> | DeleteQueryBuilder<EntityType>, input: TDeleteManyInput) {
if (input.all) {
if (input.ids?.length) {
qb.andWhere(`${this.metadata.tablePath}.id NOT IN (:...ids)`, { ids: input.ids ?? [] })
} else {
// no WHERE needed
}
} else {
if (input.ids?.length) {
input.ids = input.ids.filter(Boolean).filter(id => typeof id === 'number');
qb.andWhere(`${this.metadata.tablePath}.id IN (:...ids)`, { ids: input.ids ?? [] })
} else {
throw new HttpException(`applyDeleteMany: You have to specify ids to delete for ${this.metadata.tablePath}`, HttpStatus.BAD_REQUEST);
}
}
}