Skip to content

Commit 51ce70f

Browse files
committed
Add versioning to javascript driver
Now we do `var neo4j = require('neo4j').v1;`
1 parent 6e6162f commit 51ce70f

32 files changed

+50
-48
lines changed

README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Note: This is in active development, the API is not stable. Please try it out an
77
## Include module in Node.js application
88

99
```javascript
10-
var neo4j = require('neo4j');
10+
var neo4j = require('neo4j').v1;
1111
```
1212

1313
## Include in web browser
@@ -71,37 +71,37 @@ session.run(statement.join(' '), params)
7171

7272
## Building
7373

74-
npm install
74+
npm install
7575
npm build
7676

77-
This produces browser-compatible standalone files under `lib/browser` and a Node.js module version under `lib/`.
77+
This produces browser-compatible standalone files under `lib/browser` and a Node.js module version under `lib/`.
7878
See files under `examples/` on how to use.
7979

8080
## Testing
8181

8282
./runTests.sh
8383

84-
This runs the test suite against a fresh download of Neo4j.
84+
This runs the test suite against a fresh download of Neo4j.
8585
Or `npm test` if you already have a running version of a compatible Neo4j server.
8686

8787
### Testing on windows
88-
Running tests on windows requires PhantomJS installed and its bin folder added in windows system variable `Path`.
89-
To run the same test suite, run `.\runTest.ps1` instead in powershell with admin right.
90-
The admin right is required to start/stop Neo4j properly as a system service.
88+
Running tests on windows requires PhantomJS installed and its bin folder added in windows system variable `Path`.
89+
To run the same test suite, run `.\runTest.ps1` instead in powershell with admin right.
90+
The admin right is required to start/stop Neo4j properly as a system service.
9191
While there is no need to grab admin right if you are running tests against an existing Neo4j server using `npm test`.
9292

9393
## A note on numbers and the Integer type
94-
For this driver to fully map to the Neo4j type system handling of 64-bits Integers is needed.
95-
Javascript can saftely represent numbers between `-(2`<sup>`53`</sup>` - 1)` and `(2`<sup>`53`</sup>` - 1)`.
96-
Therefore, an Integer type is introduced.
94+
For this driver to fully map to the Neo4j type system handling of 64-bits Integers is needed.
95+
Javascript can saftely represent numbers between `-(2`<sup>`53`</sup>` - 1)` and `(2`<sup>`53`</sup>` - 1)`.
96+
Therefore, an Integer type is introduced.
9797

9898
### Write integers
99-
Number written directly e.g. `session.run("CREATE (n:Node {age: {age}})", {age: 22})` will be of type `Float` in Neo4j.
100-
To write the `age` as an integer the `neo4j.int` method should be used.
99+
Number written directly e.g. `session.run("CREATE (n:Node {age: {age}})", {age: 22})` will be of type `Float` in Neo4j.
100+
To write the `age` as an integer the `neo4j.int` method should be used.
101101
E.g. `session.run("CREATE (n:Node {age: {age}})", {age: neo4j.int(22)})`.
102102

103103
### Read integers
104-
To get the value of a from Neo4j received integer, the safeast way would be to use the `.toString()` method on
105-
an Integer object.
106-
E.g. `console.log(result.age.toString())`.
104+
To get the value of a from Neo4j received integer, the safeast way would be to use the `.toString()` method on
105+
an Integer object.
106+
E.g. `console.log(result.age.toString())`.
107107
To check if a variable is of the Integer type, the method `neo4j.isInt(variable)` can be used.

src/neo4j.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@
1717
* limitations under the License.
1818
*/
1919

20-
import {int, isInt} from './integer';
21-
import Driver from './driver';
20+
import {int, isInt} from './v1/integer';
21+
import Driver from './v1/driver';
2222

2323
let USER_AGENT = "neo4j-javascript/0.0";
2424

2525
export default {
26-
driver: (url) => new Driver( url, USER_AGENT ),
27-
int: int,
28-
isInt: isInt
26+
v1: {
27+
driver: (url) => new Driver(url, USER_AGENT),
28+
int: int,
29+
isInt: isInt
30+
}
2931
}

src/driver.js renamed to src/v1/driver.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class Driver {
4949
let _driver = this;
5050
let _session = new Session( conn, () => {
5151
// On close of session, remove it from the list of open sessions
52-
delete _driver._openSessions[sessionId];
52+
delete _driver._openSessions[sessionId];
5353
});
5454

5555
this._openSessions[sessionId] = _session;
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)