goby-database 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +12 -10
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -19,6 +19,17 @@ class Project{
|
|
|
19
19
|
console.log('opened goby database');
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
this.db.function('junction_obj', (side_a, side_b) => {
|
|
23
|
+
|
|
24
|
+
let split_1=side_a.split('.');
|
|
25
|
+
let split_2=side_b.split('.');
|
|
26
|
+
let c1=`"class_id":${split_1[0]}`;
|
|
27
|
+
let p1=split_1[1]?`,"prop_id":${split_1[1]}`:'';
|
|
28
|
+
let c2=`"class_id":${split_2[0]}`;
|
|
29
|
+
let p2=split_2[1]?`,"prop_id":${split_2[1]}`:'';
|
|
30
|
+
return `[ {${c1}${p1}}, {${c2}${p2}} ]`;
|
|
31
|
+
});
|
|
32
|
+
|
|
22
33
|
//prepared statements with arguments so my code isn't as verbose elsewhere
|
|
23
34
|
this.run={
|
|
24
35
|
begin:this.db.prepare('BEGIN IMMEDIATE'),
|
|
@@ -71,16 +82,7 @@ class Project{
|
|
|
71
82
|
'metadata TEXT'
|
|
72
83
|
]);
|
|
73
84
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
let split_1=side_a.split('.');
|
|
77
|
-
let split_2=side_b.split('.');
|
|
78
|
-
let c1=`"class_id":${split_1[0]}`;
|
|
79
|
-
let p1=split_1[1]?`,"prop_id":${split_1[1]}`:'';
|
|
80
|
-
let c2=`"class_id":${split_2[0]}`;
|
|
81
|
-
let p2=split_2[1]?`,"prop_id":${split_2[1]}`:'';
|
|
82
|
-
return `[ {${c1}${p1}}, {${c2}${p2}} ]`;
|
|
83
|
-
});
|
|
85
|
+
|
|
84
86
|
|
|
85
87
|
|
|
86
88
|
}
|