跳到主要内容

groupBySyncType()

function groupBySyncType(entities, globalSync?): Record<RepositorySyncType, EntityMetadata[]>;

Defined in: packages/rxdb/src/sync-contract/sync-type-utils.ts:376

按同步类型分组 repositories

Parameters​

ParameterTypeDescription
entitiesReadonly<EntityMetadataType>[]实体元数据数组
globalSync?| SyncOptions | EntitySyncResolver全局同步配置(可选);传实例解析器 rxdb.entitySync 时连同实例覆盖一起解析

Returns​

Record<RepositorySyncType, EntityMetadata[]>

按同步类型分组的实体

Example​

const grouped = groupBySyncType(entities);
// 返回: {
// full: [todoMetadata, commentMetadata],
// filter: [orderMetadata],
// remote: [userMetadata],
// local: [draftMetadata],
// none: [systemMetadata]
// }