IRepositoryConfig<RT>
Defined in: packages/rxdb/src/rxdb.types.ts:52
IRepositoryConfig 统一注册配置
Remarks
增量 merge 实现不在这里:它按 task 类型注册在
QueryManager.registerMergeCreateFn 一族上,由各 Repository 自己在构造期登记
(见 TreeRepository / GraphRepository)。这里只声明「用哪个类、要不要动态造实体、
哪些同步策略撑不住」。
Type Parameters
| Type Parameter | Default type |
|---|---|
RT extends RepositoryInstance | RepositoryInstance |
Properties
class
class: RepositoryConstructor<RT>;
Defined in: packages/rxdb/src/rxdb.types.ts:58
entityGenerator?
optional entityGenerator?: (metadata) =>
| EntityType
| EntityType[];
Defined in: packages/rxdb/src/rxdb.types.ts:56
根据 EntityMetadata 动态生成 Entity 类(中间表等场景)
Parameters
| Parameter | Type |
|---|---|
metadata | EntityMetadata |
Returns
| EntityType
| EntityType[]
unsupportedSyncTypes?
optional unsupportedSyncTypes?: Partial<Record<SyncType, string>>;
Defined in: packages/rxdb/src/rxdb.types.ts:80
本仓储撑不住的同步策略,键是策略、值是不支持的理由。
Remarks
注册期校验会把这里的声明翻成 unsupportedRepositorySyncType 违规,理由原样拼进消息 ——
所以理由要写清「为什么坏」和「改用什么」,它是开发者唯一能看到的说明。
「哪种仓储在哪种策略下会坏」是仓储实现的知识,核心没有判据,因此由注册方声明而不是 核心硬编码;插件注册的仓储与核心内置仓储在这条规则上走同一条路。
Example
rxdb.repository('TreeRepository', {
class: TreeRepository, // 来自 @aiao/rxdb-plugin-tree
unsupportedSyncTypes: {
[SyncType.QueryCache]: '树查询依赖本地完整的祖先链,而缓存只覆盖查过的 where 命中的行。'
}
});