|
@@ -1,8 +1,11 @@
|
|
-var level = require('level');
|
|
|
|
|
|
+const level = require('level');
|
|
|
|
+const sub = require('level-sublevel');
|
|
|
|
+const search = require('level-search');
|
|
|
|
|
|
-var database = {
|
|
|
|
|
|
+const database = {
|
|
init: function(){
|
|
init: function(){
|
|
- const db = level('./mydb');
|
|
|
|
|
|
+ this.db = sub(level("./mydb", {valueEncoding: 'json'}));
|
|
|
|
+ this.index = search(db, 'search');
|
|
},
|
|
},
|
|
open: function(callback){
|
|
open: function(callback){
|
|
return this.db.open(callback);
|
|
return this.db.open(callback);
|