1 | /*
|
2 |
|
3 | ----------------------------------------------------------------------------
|
4 | | qewd-jsdb-shell: For use in Node REPL |
|
5 | | |
|
6 | | Copyright (c) 2019 M/Gateway Developments Ltd, |
|
7 | | Redhill, Surrey UK. |
|
8 | | All rights reserved. |
|
9 | | |
|
10 | | http://www.mgateway.com |
|
11 | | Email: rtweed@mgateway.com |
|
12 | | |
|
13 | | |
|
14 | | Licensed under the Apache License, Version 2.0 (the "License"); |
|
15 | | you may not use this file except in compliance with the License. |
|
16 | | You may obtain a copy of the License at |
|
17 | | |
|
18 | | http://www.apache.org/licenses/LICENSE-2.0 |
|
19 | | |
|
20 | | Unless required by applicable law or agreed to in writing, software |
|
21 | | distributed under the License is distributed on an "AS IS" BASIS, |
|
22 | | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
23 | | See the License for the specific language governing permissions and |
|
24 | | limitations under the License. |
|
25 | ----------------------------------------------------------------------------
|
26 |
|
27 | 24 November 2019
|
28 |
|
29 | */
|
30 |
|
31 | const ydb_release = 'r1.28';
|
32 |
|
33 |
|
34 | function jsdb() {
|
35 | var qewd_mg_dbx = require('qewd-mg-dbx');
|
36 | var DocumentStore = require('ewd-document-store');
|
37 | var os = require('os');
|
38 | var arch = os.arch();
|
39 | if (arch === 'x64') arch = 'x86';
|
40 |
|
41 | var params = {
|
42 | database: {
|
43 | type: 'YottaDB',
|
44 | release: ydb_release,
|
45 | architecture: arch
|
46 | }
|
47 | };
|
48 |
|
49 | var db = new qewd_mg_dbx(params);
|
50 | var status = db.open();
|
51 | if (status.error) return status;
|
52 | var documentStore = new DocumentStore(db);
|
53 | documentStore.close = db.close.bind(db);
|
54 | return documentStore;
|
55 |
|
56 | };
|
57 |
|
58 | module.exports = jsdb();
|
59 |
|