useGraphNeighbors()
function useGraphNeighbors<T>(EntityType, options): RxDBResource<InstanceType<T>[]>;
Defined in: hooks.ts:303
查找图结构中的邻接实体
Type Parameters
| Type Parameter |
|---|
T extends GraphEntityType |
Parameters
| Parameter | Type | Description |
|---|---|---|
EntityType | T | 实体类 |
options | UseOptions<EntityStaticType<T, "findNeighborsOptions">> | 图查询参数(entityId、方向、层级等) |
Returns
RxDBResource<InstanceType<T>[]>
返回包含邻居实体的资源 signal
Example
const friends = useGraphNeighbors(User, {
entityId: 'user-1',
direction: 'out',
level: 1
});