1.0.19 • Published 3 years ago

codes.db v1.0.19

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

codes.db | Easy JSON database module.

Examples

const { DBClient } = require('code.db');

const db = new DBClient('exampledatabase');

/**
 * @returns Promise
 * Returns all of the database.
 */
db.all().then((data) => {
  console.log(data);
});

/**
 * @param  {string} data
 * @returns Promise
 */
db.get('users').then((users) => {
  console.log(users);
});

/**
 * @param  {string} data
 * @param  {any} value
 * @returns Promise
 */
db.push('users', {
  username: 'username',
  password: 'password',
}).then((user) => console.log(user));

/**
 * @param  {string} data
 * @param  {any} value
 * @returns Promise
 * you can update object with it like: db.set(`object.id`, 5) // we have updated 'object' ' s id with 5
 */
db.set('data', true);

/**
* @param  {string} data
* @param  {object} keys
* @returns Promise
* Pulls an object from an array that you specified with any key and value.
*/
db.pull('users', {
    id: '5',
})

/**
 * @param  {string} data
 * @param  {ArrayOBJ} keys
 * @returns Promise
 */
db.updateArrayObject('objectinarray', {
    key: {
        key: 'key', // id | etc..
        value: 'oldvalue' // value
    },
    newValue: 'newvalue'
})

.....

DBClient {
  all: [Function (anonymous)],
  get: [Function (anonymous)],
  set: [Function (anonymous)],
  push: [Function (anonymous)],
  pull: [Function (anonymous)],
  updateArrayObject: [Function (anonymous)],
  add: [Function (anonymous)],
  subtract: [Function (anonymous)],
  delete: [Function (anonymous)],
  database: 'dbname'
}

You can join our discord support server below:

Join our Discord server!

1.0.19

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.15

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago