Skip to content

Commit f6b1b2f

Browse files
committed
replace session.run with other functions
1 parent 8424b58 commit f6b1b2f

File tree

2 files changed

+26
-20
lines changed

2 files changed

+26
-20
lines changed

README.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,8 @@ rxSession
293293

294294
```javascript
295295
// Run a Cypher statement, reading the result in a streaming manner as records arrive:
296-
session
297-
.run('MERGE (alice:Person {name : $nameParam}) RETURN alice.name AS name', {
296+
driver
297+
.executeQuery('MERGE (alice:Person {name : $nameParam}) RETURN alice.name AS name', {
298298
nameParam: 'Alice'
299299
})
300300
.subscribe({
@@ -323,8 +323,8 @@ Subscriber API allows following combinations of `onKeys`, `onNext`, `onCompleted
323323

324324
```javascript
325325
// the Promise way, where the complete result is collected before we act on it:
326-
session
327-
.run('MERGE (james:Person {name : $nameParam}) RETURN james.name AS name', {
326+
driver
327+
.executeQuery('MERGE (james:Person {name : $nameParam}) RETURN james.name AS name', {
328328
nameParam: 'James'
329329
})
330330
.then(result => {
@@ -342,9 +342,12 @@ session
342342

343343
```javascript
344344
rxSession
345-
.run('MERGE (james:Person {name: $nameParam}) RETURN james.name AS name', {
346-
nameParam: 'Bob'
347-
})
345+
.executeRead(txc =>
346+
txc
347+
.run('MERGE (james:Person {name: $nameParam}) RETURN james.name AS name', {
348+
nameParam: 'Bob'
349+
})
350+
)
348351
.records()
349352
.pipe(
350353
map(record => record.get('name')),
@@ -447,20 +450,20 @@ _**Any javascript number value passed as a parameter will be recognized as `Floa
447450

448451
#### Writing integers
449452

450-
Numbers written directly e.g. `session.run("CREATE (n:Node {age: $age})", {age: 22})` will be of type `Float` in Neo4j.
453+
Numbers written directly e.g. `driver.executeQuery("CREATE (n:Node {age: $age})", {age: 22})` will be of type `Float` in Neo4j.
451454

452455
To write the `age` as an integer the `neo4j.int` method should be used:
453456

454457
```javascript
455458
var neo4j = require('neo4j-driver')
456459

457-
session.run('CREATE (n {age: $myIntParam})', { myIntParam: neo4j.int(22) })
460+
driver.executeQuery('CREATE (n {age: $myIntParam})', { myIntParam: neo4j.int(22) })
458461
```
459462

460463
To write an integer value that are not within the range of `Number.MIN_SAFE_INTEGER` `-(2`<sup>`53`</sup>`- 1)` and `Number.MAX_SAFE_INTEGER` `(2`<sup>`53`</sup>`- 1)`, use a string argument to `neo4j.int`:
461464

462465
```javascript
463-
session.run('CREATE (n {age: $myIntParam})', {
466+
driver.executeQuery('CREATE (n {age: $myIntParam})', {
464467
myIntParam: neo4j.int('9223372036854775807')
465468
})
466469
```

packages/neo4j-driver/README.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,8 @@ rxSession
293293

294294
```javascript
295295
// Run a Cypher statement, reading the result in a streaming manner as records arrive:
296-
session
297-
.run('MERGE (alice:Person {name : $nameParam}) RETURN alice.name AS name', {
296+
driver
297+
.executeQuery('MERGE (alice:Person {name : $nameParam}) RETURN alice.name AS name', {
298298
nameParam: 'Alice'
299299
})
300300
.subscribe({
@@ -323,8 +323,8 @@ Subscriber API allows following combinations of `onKeys`, `onNext`, `onCompleted
323323

324324
```javascript
325325
// the Promise way, where the complete result is collected before we act on it:
326-
session
327-
.run('MERGE (james:Person {name : $nameParam}) RETURN james.name AS name', {
326+
driver
327+
.executeQuery('MERGE (james:Person {name : $nameParam}) RETURN james.name AS name', {
328328
nameParam: 'James'
329329
})
330330
.then(result => {
@@ -342,9 +342,12 @@ session
342342

343343
```javascript
344344
rxSession
345-
.run('MERGE (james:Person {name: $nameParam}) RETURN james.name AS name', {
346-
nameParam: 'Bob'
347-
})
345+
.executeRead(txc =>
346+
txc
347+
.run('MERGE (james:Person {name: $nameParam}) RETURN james.name AS name', {
348+
nameParam: 'Bob'
349+
})
350+
)
348351
.records()
349352
.pipe(
350353
map(record => record.get('name')),
@@ -447,20 +450,20 @@ _**Any javascript number value passed as a parameter will be recognized as `Floa
447450

448451
#### Writing integers
449452

450-
Numbers written directly e.g. `session.run("CREATE (n:Node {age: $age})", {age: 22})` will be of type `Float` in Neo4j.
453+
Numbers written directly e.g. `driver.executeQuery("CREATE (n:Node {age: $age})", {age: 22})` will be of type `Float` in Neo4j.
451454

452455
To write the `age` as an integer the `neo4j.int` method should be used:
453456

454457
```javascript
455458
var neo4j = require('neo4j-driver')
456459

457-
session.run('CREATE (n {age: $myIntParam})', { myIntParam: neo4j.int(22) })
460+
driver.executeQuery('CREATE (n {age: $myIntParam})', { myIntParam: neo4j.int(22) })
458461
```
459462

460463
To write an integer value that are not within the range of `Number.MIN_SAFE_INTEGER` `-(2`<sup>`53`</sup>`- 1)` and `Number.MAX_SAFE_INTEGER` `(2`<sup>`53`</sup>`- 1)`, use a string argument to `neo4j.int`:
461464

462465
```javascript
463-
session.run('CREATE (n {age: $myIntParam})', {
466+
driver.executeQuery('CREATE (n {age: $myIntParam})', {
464467
myIntParam: neo4j.int('9223372036854775807')
465468
})
466469
```

0 commit comments

Comments
 (0)