@sojs_coder/db
v1.5.7
Published
A no-server database module. All database contents are stored locally.
Downloads
9
Readme
Usage
Setting Up:
Create a database:
const myDB = new DB('<dbname>')
The only parameter: the name of your database.
Seting Values:
myDB.set('<key>','<val>',<callback: function>);
can be a list
, object
or string
. 1 argument is passed to the callback: The JSON that has been appended to the database.
Getting Values
myDB.get('<key>',<callback: function>)
is the key that you set in myDB.set()
. The value of the key is passed to the callback function.
Getting all contents of the DB
myDB.dump(<callback: function>);
One argument passed to the callback: the entire db in JSON format.
Deleting a key
myDB.delete('<key>',<callback: function>)
is the key that you want to delete. One argument passed to the callback: the value of the key that you deleted.
Getting all keys in the DB
myDB.getKeys(<callback: function>);
The callback accepts one argument: an array of all keys.
Have a new feature idea? Is there a bug? Contact me
Made with love by SoJS
© 2020.
Update logs:
(Added v.1.2.5)
v.1.0.0
- Just an empty readme file
v.1.2.1
- DB class added.
get
function createdset
function added
v.1.2.2
- readme file updated (and npm wont let you rewrite a version)
v.1.2.3
- minor bug fixes
v.1.2.4
- I realize that if forgot a
module.exports
. How thick of me ;(
v.1.4.4
dump
function addeddelete
function added
v.1.5.6
getKeys
function added- minnor bug in setting JSON values fixed.
- minor bug fix in deleting keys