Skip to content

Commit 5f1a8c5

Browse files
committed
fix example
1 parent 5a1013b commit 5f1a8c5

File tree

3 files changed

+23
-27
lines changed

3 files changed

+23
-27
lines changed

examples/RedisGraphExample.js

+17-22
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,21 @@ const RedisGraph = require('../src/redisGraph');
33

44
let graph = new RedisGraph('social');
55

6-
graph.query("CREATE (:person{name:'roi',age:32})").then( (res) => {
7-
console.log('@1111')
8-
console.log(res);
6+
graph
7+
.query("CREATE (:person{name:'roi',age:32})")
8+
.then( () => {
9+
return graph.query("CREATE (:person{name:'amit',age:30})");
10+
})
11+
.then( () => {
12+
return graph.query("MATCH (a:person), (b:person) WHERE (a.name = 'roi' AND b.name='amit') CREATE (a)-[knows]->(a)")
13+
})
14+
.then( () => {
15+
return graph.query("MATCH (a:person)-[knows]->(:person) RETURN a")
16+
})
17+
.then( (res) => {
18+
while(res.hasNext()){
19+
let record = res.next();
20+
console.log(record.getString('a.name'));
21+
}
22+
console.log(res.getStatistics().queryExecutionTime());
923
});
10-
graph.query("CREATE (:person{name:'amit',age:30})").then( (res) => {
11-
console.log(res);
12-
console.log("AAA " + res.getStatistics().nodesCreated());
13-
});
14-
15-
graph.query("MATCH (a:person), (b:person) WHERE (a.name = 'roi' AND b.name='amit') CREATE (a)-[knows]->(a)").then( (res) => {
16-
console.log('@33333')
17-
console.log(res);
18-
});
19-
//
20-
graph.query("MATCH (a:person)-[knows]->(:person) RETURN a").then( (res) => {
21-
console.log(res);
22-
console.log("AAA " + res.getStatistics().nodesCreated());
23-
});
24-
//
25-
//while(resultSet.hasNext()){
26-
// Record record = resultSet.next();
27-
// System.out.println(record.getString("a.name"));
28-
//}

src/record.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,5 @@ module.exports = class Record {
3030

3131
size() {
3232
return this._header.length;
33-
}
34-
35-
toString() {
36-
return this._values.toString();
37-
}
33+
}
3834
}

src/statistics.js

+5
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,10 @@ module.exports ={
6868
propertiesSet() {
6969
return this.getIntValue(Label.PROPERTIES_SET);
7070
}
71+
72+
queryExecutionTime() {
73+
return this.getIntValue(Label.QUERY_INTERNAL_EXECUTION_TIME);
74+
}
75+
7176
}
7277
}

0 commit comments

Comments
 (0)