跳到主要内容

useGraphNeighbors()

function useGraphNeighbors<T>(EntityType, options): RxDBResource<InstanceType<T>[]>;

Defined in: hooks.ts:318

Find neighbor entities in a graph structure

Type Parameters

Type Parameter
T extends EntityType

Parameters

ParameterTypeDescription
EntityTypeTThe entity class
optionsUseOptions<EntityStaticType<T, "findNeighborsOptions">>Graph query options (entityId, direction, level, etc.)

Returns

RxDBResource<InstanceType<T>[]>

A resource object containing neighbor entities

Example

const { value: friends } = useGraphNeighbors(User, {
entityId: 'user-1',
direction: 'out',
level: 1
});