Comparing version 0.0.1 to 0.0.2
@@ -38,6 +38,15 @@ "use strict"; | ||
}; | ||
this.collection = (name) => { | ||
this.collection = (name) => __awaiter(this, void 0, void 0, function* () { | ||
this.path = this.dbname + '/' + name + ".json"; | ||
try { | ||
let result = yield this.fileExist(this.path); | ||
if (result && result.status == 404) { | ||
yield this.createFile(this.path); | ||
} | ||
} | ||
catch (error) { | ||
return { status: 404, msg: 'erro in created file path' }; | ||
} | ||
return new collection_1.ColletionMap(this); | ||
}; | ||
}); | ||
this.fileExist = (path) => __awaiter(this, void 0, void 0, function* () { | ||
@@ -54,11 +63,2 @@ this.path = path; | ||
this.insertOne = (data) => __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
let result = yield this.fileExist(this.path); | ||
if (result && result.status == 404) { | ||
yield this.createFile(this.path); | ||
} | ||
} | ||
catch (error) { | ||
return { status: 404, msg: 'erro in created file path' }; | ||
} | ||
const result = yield this.insertToOne(data); | ||
@@ -65,0 +65,0 @@ return result ? result : { status: 404, msg: 'erro in add path' }; |
@@ -15,5 +15,5 @@ const { Bionic } = require('./dist/index'); | ||
(async function(){ | ||
const db = bionic.db('superchats') | ||
let collection = await db.deleteDB() | ||
const db = bionic.db('brb') | ||
let collection = await db.collection('teste') | ||
})(); |
{ | ||
"name": "bionicdb", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "database modern", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27182