Update repository.md

This commit is contained in:
Pearl C 2023-01-26 23:04:02 +08:00 committed by GitHub
parent 2787a03cfd
commit 12cc5b9174
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,6 +34,7 @@ userRepository.find({
}); });
``` ```
#### Operator #### Operator
The `filter` parameter in the `Repository` also provides a variety of operators to perform more diverse queries. The `filter` parameter in the `Repository` also provides a variety of operators to perform more diverse queries.
@ -170,7 +171,6 @@ await userRepository.create([
age: 20, age: 20,
}, },
]) ])
``` ```
#### Create Association #### Create Association
@ -388,6 +388,7 @@ Find datasets from the database with the specified filtering conditions and sort
* `async find(options?: FindOptions): Promise<Model[]>` * `async find(options?: FindOptions): Promise<Model[]>`
**Type** **Type**
```typescript ```typescript
type Filter = FilterWithOperator | FilterWithValue | FilterAnd | FilterOr; type Filter = FilterWithOperator | FilterWithValue | FilterAnd | FilterOr;
type Appends = string[]; type Appends = string[];
@ -515,6 +516,7 @@ Query a certain amount of data from the database for specific conditions. Equiva
* `count(options?: CountOptions): Promise<number>` * `count(options?: CountOptions): Promise<number>`
**Type** **Type**
```typescript ```typescript
interface CountOptions extends Omit<SequelizeCountOptions, 'distinct' | 'where' | 'include'>, Transactionable { interface CountOptions extends Omit<SequelizeCountOptions, 'distinct' | 'where' | 'include'>, Transactionable {
filter?: Filter; filter?: Filter;
@ -533,7 +535,6 @@ const count = await books.count({
}); });
``` ```
### `findAndCount()` ### `findAndCount()`
Find datasets from the database with the specified filtering conditions and return the number of results. Equivalent to `Model.findAndCountAll()` in Sequelize. Find datasets from the database with the specified filtering conditions and return the number of results. Equivalent to `Model.findAndCountAll()` in Sequelize.
@ -543,6 +544,7 @@ Find datasets from the database with the specified filtering conditions and retu
* `async findAndCount(options?: FindAndCountOptions): Promise<[Model[], number]>` * `async findAndCount(options?: FindAndCountOptions): Promise<[Model[], number]>`
**Type** **Type**
```typescript ```typescript
type FindAndCountOptions = Omit<SequelizeAndCountOptions, 'where' | 'include' | 'order'> & CommonFindOptions; type FindAndCountOptions = Omit<SequelizeAndCountOptions, 'where' | 'include' | 'order'> & CommonFindOptions;
``` ```
@ -588,6 +590,7 @@ Inserts multiple newly created data into the data table. This is equivalent to c
* `createMany(options: CreateManyOptions): Promise<Model[]>` * `createMany(options: CreateManyOptions): Promise<Model[]>`
**Type** **Type**
```typescript ```typescript
interface CreateManyOptions extends BulkCreateOptions { interface CreateManyOptions extends BulkCreateOptions {
records: Values[]; records: Values[];