useGraphPaths()
function useGraphPaths<T>(EntityType, options): RxDBResource<GraphQueryResult<GraphPath<T>>>;
Defined in: rxdb-vue/src/hooks.ts:439
查找图中两个实体之间的路径
Type Parameters
| Type Parameter |
|---|
T extends GraphEntityType |
Parameters
| Parameter | Type | Description |
|---|---|---|
EntityType | T | 实体类 |
options | UseOptions<EntityStaticType<T, "findPathsOptions">> | 路径查询选项(fromId、toId、maxDepth 等) |
Returns
RxDBResource<GraphQueryResult<GraphPath<T>>>
包含路径的响应式资源对象
Example
// 整体持有:resource 是 reactive 对象,解构会拿到一次性快照(见 RxDBResource)
const paths = useGraphPaths(User, {
fromId: 'user-1',
toId: 'user-2',
maxDepth: 5
});
// 模板里用 paths.value / paths.isLoading