-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c3951bc
commit 14bc62d
Showing
130 changed files
with
3,823 additions
and
4,027 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,78 @@ | ||
# DataSource (abstract) | ||
|
||
`DataSource` 抽象类,用于表示一种类型的数据源,可以是数据库、API等。 | ||
The `DataSource` abstract class is used to represent a type of data source, which can be a database, API, etc. | ||
|
||
## 成员 | ||
## Members | ||
|
||
### collectionManager | ||
|
||
数据源的 CollectionManager 实例,需实现 [`ICollectionManager`](/api/data-source-manager/i-collection-manager) 接口。 | ||
The CollectionManager instance of the data source, which needs to implement the [`ICollectionManager`](/api/data-source-manager/i-collection-manager) interface. | ||
|
||
### resourceManager | ||
|
||
数据源的 resourceManager 实例,详见:[`resourceManager`](/api/resourcer/resource-manager) | ||
The resourceManager instance of the data source, see: [`resourceManager`](/api/resourcer/resource-manager) | ||
|
||
### acl | ||
|
||
数据源的 ACL 实例,详见: [`ACL`](/api/acl/acl) | ||
The ACL instance of the data source, see: [`ACL`](/api/acl/acl) | ||
|
||
## API | ||
|
||
### constructor() | ||
|
||
构造函数,创建一个 `DataSource` 实例。 | ||
Constructor, creates a `DataSource` instance. | ||
|
||
#### 签名 | ||
#### Signature | ||
|
||
- `constructor(options: DataSourceOptions)` | ||
|
||
### init() | ||
### init() | ||
|
||
初始化函数,在 `constructor` 之后既被调用。 | ||
Initialization function, called immediately after `constructor`. | ||
|
||
#### 签名 | ||
#### Signature | ||
|
||
- `init(options: DataSourceOptions)` | ||
|
||
|
||
### name | ||
|
||
#### 签名 | ||
#### Signature | ||
|
||
- `get name()` | ||
|
||
响应数据源的实例名称 | ||
Returns the instance name of the data source. | ||
|
||
### middleware() | ||
|
||
获得 DataSource 的中间件,用于挂载到 Server 中接收请求。 | ||
Gets the middleware of the DataSource, used to mount to the Server to receive requests. | ||
|
||
### testConnection() | ||
|
||
静态方法,在测试连接操作时调用,可用于参数校验,具体逻辑由子类实现。 | ||
Static method, called during the test connection operation, can be used for parameter validation, specific logic is implemented by subclasses. | ||
|
||
#### 签名 | ||
#### Signature | ||
|
||
- `static testConnection(options?: any): Promise<boolean>` | ||
|
||
### load() | ||
|
||
#### 签名 | ||
#### Signature | ||
|
||
- `async load(options: any = {})` | ||
|
||
数据源的加载操作,逻辑由子类实现。 | ||
The loading operation of the data source, logic is implemented by subclasses. | ||
|
||
### createCollectionManager() | ||
|
||
#### 签名 | ||
#### Signature | ||
- `abstract createCollectionManager(options?: any): ICollectionManager` | ||
|
||
创建数据源的 CollectionManager 实例,逻辑由子类实现。 | ||
Creates a CollectionManager instance for the data source, logic is implemented by subclasses. | ||
|
||
### createResourceManager() | ||
|
||
创建数据源的 ResourceManager 实例,字类可覆盖实现,默认创建 `@nocobase/resourcer` 中的 `ResourceManager`。 | ||
Creates a ResourceManager instance for the data source, subclasses can override the implementation, by default creates `ResourceManager` from `@nocobase/resourcer`. | ||
|
||
### createACL() | ||
|
||
- 创建 DataSource 的 ACL 实例,字类可覆盖实现,默认创建 `@nocobase/acl` 中的 `ACL`。 | ||
|
||
- Creates an ACL instance for the DataSource, subclasses can override the implementation, by default creates `ACL` from `@nocobase/acl`. |
59 changes: 28 additions & 31 deletions
59
docs/en-US/api/data-source-manager/i-collection-manager.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,112 +1,109 @@ | ||
# ICollectionManager | ||
|
||
`ICollectionManager` 接口,用于管理数据源的 `Collection` 实例。 | ||
The `ICollectionManager` interface is used to manage `Collection` instances of data sources. | ||
|
||
## API | ||
|
||
### registerFieldTypes() | ||
|
||
注册 `Collection` 中的字段类型。 | ||
Registers the field types in a `Collection`. | ||
|
||
#### 签名 | ||
#### Signature | ||
|
||
- `registerFieldTypes(types: Record<string, any>): void` | ||
|
||
### registerFieldInterfaces() | ||
|
||
注册 `Collection` 的 `Interface` 。 | ||
Registers the `Interface` for a `Collection`. | ||
|
||
#### 签名 | ||
#### Signature | ||
|
||
- `registerFieldInterfaces(interfaces: Record<string, any>): void` | ||
|
||
### registerCollectionTemplates() | ||
|
||
注册 `Collection Template`。 | ||
Registers `Collection Templates`. | ||
|
||
#### 签名 | ||
#### Signature | ||
|
||
- `registerCollectionTemplates(templates: Record<string, any>): void` | ||
|
||
### registerModels() | ||
|
||
注册 `Model`。 | ||
Registers `Models`. | ||
|
||
#### 签名 | ||
#### Signature | ||
|
||
- `registerModels(models: Record<string, any>): void` | ||
|
||
### registerRepositories() | ||
|
||
注册 `Repository`。 | ||
Registers `Repositories`. | ||
|
||
#### 签名 | ||
#### Signature | ||
|
||
- `registerRepositories(repositories: Record<string, any>): void` | ||
|
||
### getRegisteredRepository() | ||
|
||
获取已注册的仓库实例。 | ||
Retrieves an instance of a registered repository. | ||
|
||
#### 签名 | ||
#### Signature | ||
|
||
- `getRegisteredRepository(key: string): IRepository` | ||
|
||
### defineCollection() | ||
|
||
定义一个 `Collection`。 | ||
Defines a `Collection`. | ||
|
||
#### 签名 | ||
#### Signature | ||
|
||
- `defineCollection(options: CollectionOptions): ICollection` | ||
|
||
### extendCollection() | ||
|
||
修改一个已存在的 `Collection` 属性。 | ||
Modifies an existing `Collection` property. | ||
|
||
#### 签名 | ||
#### Signature | ||
|
||
- `extendCollection(collectionOptions: CollectionOptions, mergeOptions?: MergeOptions): ICollection` | ||
|
||
### hasCollection() | ||
|
||
判断 `Collection` 是否存在。 | ||
|
||
#### 签名 | ||
Determines if a `Collection` exists. | ||
|
||
#### Signature | ||
|
||
- `hasCollection(name: string): boolean` | ||
|
||
### getCollection() | ||
|
||
获取 `Collection` 实例。 | ||
Retrieves an instance of a `Collection`. | ||
|
||
#### 签名 | ||
#### Signature | ||
|
||
- `getCollection(name: string): ICollection` | ||
|
||
### getCollections() | ||
|
||
获取所有的 `Collection` 实例。 | ||
Retrieves all instances of `Collection`. | ||
|
||
#### 签名 | ||
#### Signature | ||
|
||
- `getCollections(): Array<ICollection>` | ||
|
||
### getRepository() | ||
|
||
获取 `Repository` 实例。 | ||
Retrieves an instance of a `Repository`. | ||
|
||
#### 签名 | ||
#### Signature | ||
|
||
- `getRepository(name: string, sourceId?: string | number): IRepository` | ||
|
||
### sync() | ||
|
||
同步数据源,逻辑由子类实现。 | ||
|
||
#### 签名 | ||
|
||
- `sync(): Promise<void>` | ||
Synchronizes the data source, with the logic implemented by subclasses. | ||
|
||
#### Signature | ||
|
||
- `sync(): Promise<void>` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.