TreeAdjacencyListEntityBase<Id>
Defined in: rxdb-plugin-tree/src/entity/tree-entity-base.ts:46
树形实体装饰器配置 定义了树形结构所需的父子关系
Extends
EntityBase<Id>
Type Parameters
| Type Parameter | Default type |
|---|---|
Id extends RxDBEntityId | UUID |
Implements
Constructors
Constructor
new TreeAdjacencyListEntityBase<Id>(initData?): TreeAdjacencyListEntityBase<Id>;
Defined in: rxdb/dist/entity/entity-base.d.ts:129
实体基类构造函数 子类会通过 Entity 装饰器增强此构造函数
Parameters
| Parameter | Type |
|---|---|
initData? | unknown |
Returns
TreeAdjacencyListEntityBase<Id>
Inherited from
Properties
createdAt
readonly createdAt: Date;
Defined in: rxdb/dist/entity/entity-base.d.ts:53
创建时间 实体创建时自动设置为当前时间
Implementation of
Inherited from
createdBy?
readonly optional createdBy?: `${string}-${string}-${string}-${string}-${string}` | null;
Defined in: rxdb/dist/entity/entity-base.d.ts:63
创建者ID 记录创建此实体的用户ID
Implementation of
Inherited from
hasChildren?
optional hasChildren?: boolean | null;
Defined in: rxdb-plugin-tree/src/entity/tree-entity-base.ts:59
是否有子节点,由数据库计算属性自动填充。
declare 因为它是 metadata 注入的计算属性,class 不需要初始化。
Implementation of
id
readonly id: Id;
Defined in: rxdb/dist/entity/entity-base.d.ts:48
实体唯一标识符 自动生成的UUID,作为主键
Implementation of
Inherited from
parentId?
optional parentId?: Id | null;
Defined in: rxdb-plugin-tree/src/entity/tree-entity-base.ts:53
父节点ID
Implementation of
remove
remove: () => Promise<TreeAdjacencyListEntityBase<Id>>;
Defined in: rxdb/dist/entity/entity-base.d.ts:114
删除
Returns
Promise<TreeAdjacencyListEntityBase<Id>>
Inherited from
reset
reset: () => void;
Defined in: rxdb/dist/entity/entity-base.d.ts:118
重置数据
Returns
void
Inherited from
save
save: () => Promise<TreeAdjacencyListEntityBase<Id>>;
Defined in: rxdb/dist/entity/entity-base.d.ts:122
保存
Returns
Promise<TreeAdjacencyListEntityBase<Id>>
Inherited from
updatedAt
readonly updatedAt: Date;
Defined in: rxdb/dist/entity/entity-base.d.ts:58
更新时间 实体创建或更新时自动设置为当前时间
Implementation of
Inherited from
updatedBy?
readonly optional updatedBy?: `${string}-${string}-${string}-${string}-${string}` | null;
Defined in: rxdb/dist/entity/entity-base.d.ts:68
更新者ID 记录最后更新此实体的用户ID
Implementation of
Inherited from
count
static count: <T>(this, options) => Observable<number>;
Defined in: rxdb/dist/entity/entity-base.d.ts:110
查询实体数量
Type Parameters
| Type Parameter |
|---|
T extends EntityBase<RxDBEntityId> |
Parameters
| Parameter | Type | Description |
|---|---|---|
this | () => T | - |
options | CountOptions<() => T> | 查询选项,包含 where 条件 |
Returns
Observable<number>
Observable 包装的数量
Inherited from
countAncestors
static countAncestors: <T>(this, options) => Observable<number>;
Defined in: rxdb-plugin-tree/src/entity/tree-entity-base.ts:96
统计祖先节点数量
Type Parameters
| Type Parameter |
|---|
T extends TreeAdjacencyListEntityBase<RxDBEntityId> |
Parameters
| Parameter | Type | Description |
|---|---|---|
this | () => T | - |
options | FindTreeOptions<() => T> | 查询选项,包含实体ID和层级深度 |
Returns
Observable<number>
Observable 包装的祖先节点数量
countDescendants
static countDescendants: <T>(this, options) => Observable<number>;
Defined in: rxdb-plugin-tree/src/entity/tree-entity-base.ts:76
统计子孙节点数量
Type Parameters
| Type Parameter |
|---|
T extends TreeAdjacencyListEntityBase<RxDBEntityId> |
Parameters
| Parameter | Type | Description |
|---|---|---|
this | () => T | - |
options | FindTreeOptions<() => T> | 查询选项,包含实体ID和层级深度 |
Returns
Observable<number>
Observable 包装的子孙节点数量
find
static find: <T>(this, options) => Observable<T[]>;
Defined in: rxdb/dist/entity/entity-base.d.ts:92
查询多个实体
Type Parameters
| Type Parameter |
|---|
T extends EntityBase<RxDBEntityId> |
Parameters
| Parameter | Type | Description |
|---|---|---|
this | () => T | - |
options | FindOptions<() => T> | 查询选项,包含 where 条件、limit、offset 等 |
Returns
Observable<T[]>
Observable 包装的实体实例数组
Inherited from
findAll
static findAll: <T>(this, options) => Observable<T[]>;
Defined in: rxdb/dist/entity/entity-base.d.ts:98
查询所有实体
Type Parameters
| Type Parameter |
|---|
T extends EntityBase<RxDBEntityId> |
Parameters
| Parameter | Type | Description |
|---|---|---|
this | () => T | - |
options | FindAllOptions<() => T> | 查询选项,包含 where 条件和排序(不限制数量) |
Returns
Observable<T[]>
Observable 包装的实体实例数组
Inherited from
findAncestors
static findAncestors: <T>(this, options) => Observable<T[]>;
Defined in: rxdb-plugin-tree/src/entity/tree-entity-base.ts:86
查询所有祖先节点
Type Parameters
| Type Parameter |
|---|
T extends TreeAdjacencyListEntityBase<RxDBEntityId> |
Parameters
| Parameter | Type | Description |
|---|---|---|
this | () => T | - |
options | FindTreeOptions<() => T> | 查询选项,包含实体ID和层级深度 |
Returns
Observable<T[]>
Observable 包装的祖先节点数组
findByCursor
static findByCursor: <T>(this, options) => Observable<T[]>;
Defined in: rxdb/dist/entity/entity-base.d.ts:104
通过游标进行分页查询
Type Parameters
| Type Parameter |
|---|
T extends EntityBase<RxDBEntityId> |
Parameters
| Parameter | Type | Description |
|---|---|---|
this | () => T | - |
options | FindByCursorOptions<() => T> | 游标分页选项,包含 orderBy、before/after 游标 |
Returns
Observable<T[]>
Observable 包装的实体实例数组
Inherited from
findDescendants
static findDescendants: <T>(this, options) => Observable<T[]>;
Defined in: rxdb-plugin-tree/src/entity/tree-entity-base.ts:66
查询所有子孙节点
Type Parameters
| Type Parameter |
|---|
T extends TreeAdjacencyListEntityBase<RxDBEntityId> |
Parameters
| Parameter | Type | Description |
|---|---|---|
this | () => T | - |
options | FindTreeOptions<() => T> | 查询选项,包含实体ID和层级深度 |
Returns
Observable<T[]>
Observable 包装的子孙节点数组
findOne
static findOne: <T>(this, options) => Observable<T | null>;
Defined in: rxdb/dist/entity/entity-base.d.ts:80
查找一个实体
Type Parameters
| Type Parameter |
|---|
T extends EntityBase<RxDBEntityId> |
Parameters
| Parameter | Type | Description |
|---|---|---|
this | () => T | - |
options | FindOneOptions<() => T> | 查询选项,包含 where 条件 |
Returns
Observable<T | null>
Observable 包装的实体实例或 null
Inherited from
findOneOrFail
static findOneOrFail: <T>(this, options) => Observable<T>;
Defined in: rxdb/dist/entity/entity-base.d.ts:86
查找一个实体,查不到就抛出错误
Type Parameters
| Type Parameter |
|---|
T extends EntityBase<RxDBEntityId> |
Parameters
| Parameter | Type | Description |
|---|---|---|
this | () => T | - |
options | FindOneOrFailOptions<() => T> | 查询选项,包含 where 条件 |
Returns
Observable<T>
Observable 包装的实体实例
Inherited from
get
static get: <T>(this, id) => Observable<T>;
Defined in: rxdb/dist/entity/entity-base.d.ts:74
根据 id 获取实体
Type Parameters
| Type Parameter |
|---|
T extends EntityBase<RxDBEntityId> |
Parameters
| Parameter | Type | Description |
|---|---|---|
this | () => T | - |
id | T["id"] | 实体的唯一标识符 |
Returns
Observable<T>
Observable 包装的实体实例