@istock/iswork / Exports / Repository
Class: Repository
仓库,可扩展基本方法,添加默认查询条件
Table of contents
Constructors
Properties
Methods
Constructors
constructor
• new Repository(repositoryManager
): Repository
Parameters
Name | Type |
---|---|
repositoryManager | RepositoryManager |
Returns
Defined in
src/packages/iswork/src/orm/repository/repository.ts:10
Properties
#repositoryManager
• Private
Readonly
#repositoryManager: RepositoryManager
Defined in
src/packages/iswork/src/orm/repository/repository.ts:8
Methods
createMany
▸ createMany(model
, createDatas
): Promise
<(string
| number
)[]>
Parameters
Name | Type |
---|---|
model | typeof BaseModel |
createDatas | TIdAnyObject [] |
Returns
Promise
<(string
| number
)[]>
Defined in
src/packages/iswork/src/orm/repository/repository.ts:27
createOne
▸ createOne(model
, createData
): Promise
<null
| string
| number
>
Parameters
Name | Type |
---|---|
model | typeof BaseModel |
createData | TIdAnyObject |
Returns
Promise
<null
| string
| number
>
Defined in
src/packages/iswork/src/orm/repository/repository.ts:22
deleteById
▸ deleteById(model
, id
): Promise
<boolean
>
Parameters
Name | Type |
---|---|
model | typeof BaseModel |
id | string | number |
Returns
Promise
<boolean
>
Defined in
src/packages/iswork/src/orm/repository/repository.ts:45
deleteMany
▸ deleteMany(model
, query
): Promise
<boolean
>
Parameters
Name | Type |
---|---|
model | typeof BaseModel |
query | TOrmQuery |
Returns
Promise
<boolean
>
Defined in
src/packages/iswork/src/orm/repository/repository.ts:41
findOneById
▸ findOneById(model
, id
): Promise
<unknown
>
Parameters
Name | Type |
---|---|
model | typeof BaseModel |
id | string | number |
Returns
Promise
<unknown
>
Defined in
src/packages/iswork/src/orm/repository/repository.ts:51
query
▸ query<Result
>(model
, query
): Promise
<Result
[]>
Type parameters
Name | Type |
---|---|
Result | unknown |
Parameters
Name | Type |
---|---|
model | typeof BaseModel |
query | TOrmQuery |
Returns
Promise
<Result
[]>
Defined in
src/packages/iswork/src/orm/repository/repository.ts:18
run
▸ run<Result
>(model
, ...executeArgs
): Promise
<Result
>
Type parameters
Name | Type |
---|---|
Result | unknown |
Parameters
Name | Type |
---|---|
model | typeof BaseModel |
...executeArgs | unknown [] |
Returns
Promise
<Result
>
Defined in
src/packages/iswork/src/orm/repository/repository.ts:14
updateById
▸ updateById(model
, id
, updateData
): Promise
<boolean
>
Parameters
Name | Type |
---|---|
model | typeof BaseModel |
id | string | number |
updateData | TAnyObj |
Returns
Promise
<boolean
>
Defined in
src/packages/iswork/src/orm/repository/repository.ts:35
updateMany
▸ updateMany(model
, updateDataList
): Promise
<boolean
>
Parameters
Name | Type |
---|---|
model | typeof BaseModel |
updateDataList | TIdAnyObject [] |
Returns
Promise
<boolean
>
Defined in
src/packages/iswork/src/orm/repository/repository.ts:31