useGraphPaths()
function useGraphPaths<T>(EntityType, options): RxDBResource<unknown[]>;
Defined in: hooks.ts:343
查找图结构中两个实体之间的路径
Type Parameters
| Type Parameter |
|---|
T extends GraphEntityType |
Parameters
| Parameter | Type | Description |
|---|---|---|
EntityType | T | 实体类 |
options | UseOptions<EntityStaticType<T, "findPathsOptions">> | 路径查询参数(fromId、toId、最大深度等) |
Returns
RxDBResource<unknown[]>
返回包含路径的资源 signal
Example
const paths = useGraphPaths(User, {
fromId: 'user-1',
toId: 'user-2',
maxDepth: 5
});