跳到主要内容

FindTreeOptions<T, WhereType>

Defined in: rxdb-plugin-tree/src/repository/tree-repository.interface.ts:6

树结构查询配置

Type Parameters​

Type ParameterDefault type
T extends EntityTypeEntityType
WhereTypeRuleGroup<InstanceType<T>>

Properties​

entityId?​

optional entityId?:
| EntityStaticType<T, "idType">
| null;

Defined in: rxdb-plugin-tree/src/repository/tree-repository.interface.ts:10

查询的根实体 ID


level?​

optional level?: number;

Defined in: rxdb-plugin-tree/src/repository/tree-repository.interface.ts:36

查询深度(层级数包含当前节点本身)

  • 不传:不限深度 —— findDescendants 返回整棵子树、findAncestors 返回整条祖先链
  • 0:仅当前节点(entityId 为空时即所有根节点)
  • 1:当前节点 + 直接子节点
  • n:查询到第 n 层深度

Default Value​

undefined(不限深度)

Remarks​

不裁剪、不兜底:非负整数以外的值(负数、小数、NaN、字符串)一律抛 RxDBError。 level 是树查询里唯一被直接插值进递归 CTE 比较式的选项,悄悄改写它等于把注入 变成一次静默的错误查询。插件的 assertTreeLevel 与各适配器复用核心的通用数值校验, 绕过 Repository 直接调适配器时同样抛错。

不传时递归深度由各 SQL 适配器内部的失控保护常量兜底(防脏数据把 parentId 连成环), 那是实现细节而非查询语义:正常树不会触到。


where?​

optional where?: WhereType;

Defined in: rxdb-plugin-tree/src/repository/tree-repository.interface.ts:15

查询条件