smallorange-redis-edge-graph
v1.3.2
Published
Minimum graph's edge data structure implemented with redis
Downloads
19
Readme
Small Orange Redis Edge Graph
Node API
delete({
entity? string,
node: string
}): Observable<object>;
get({
entity? string,
node: string
}): Observable<object>;
multiGet({
entity? string,
nodes: Array<string>
}): Observable<Array<object>>;
set({
entity? string,
node: string,
data: object
}): Observable<object>;
multiSet({
entity? string,
values: Array<{
node: string,
data?: object
}>,
}): Observable<Array<object>>;
patch({
entity? string,
node: string,
data: object
}): Observable<object>;
Edge API
allAll({
collection: Array<string>,
direction?: string
distance?: (collectionSize, fromNodeIndex, toNodeIndex) => number,
entity? string,
noTimestamp?: boolean
}): Observable<object>;
count({
direction?: string
entity? string,
fromNode: string,
max?: number,
min?: number
}): Observable<number>;
delete({
direction?: string
entity? string,
fromNode: string,
toNode: string
}): Observable<object>;
deleteMatchingNode({
fromNode: string
}): Observable<object>;
all(): Observable<object>;
allMatchingNode({
by?: 'distance' | 'timestamp',
direction?: string
entity? string,
fromNode: string,
toNode: string,
noInverse?: boolean,
onlyNodes?: boolean
}): Observable<object>;
closest({
desc?: boolean,
direction?: string
distance?: [min?: number, max?: number],
entity? string,
filter? string,
fromNode: string,
limit: [min?: number, max?: number],
timestamp: [min?: number, max?: number]
}): Observable<object>;
link({
absoluteDistance?: number,
direction?: string
distance?: number,
entity? string,
fromNode: string,
noTimestamp?: boolean,
toNode: string
}): Observable<object>;
traverse({
concurrency?: number,
jobs: Array<{
absoluteDistance?: number,
direction?: string
distance?: number,
entity? string,
fromNode: string,
noTimestamp?: boolean,
toNode: string
}>,
maxPath: number,
minPath: number,
remoteClosest: function,
remoteClosestIndex: number
}): Observable<object>;
Sample
const Redis = require('smallorange-redis-client');
const {
Edge,
Node
} = require('smallorange-redis-edge-graph');
class App {
constructor() {
const redis = new Redis({
connection: {
port: 6380
}
});
this.redis = redis;
this.namespace = 'graph-1';
this.node = new Node({
namespace: 'graphName',
redis
});
this.edge = new Edge({
namespace: 'graphName',
node: this.node,
redis
});
}
}