1.0.9 • Published 7 months ago

evelodb v1.0.9

Weekly downloads
-
License
ISC
Repository
-
Last release
7 months ago

Requirements

  • Node.js

Installation

Via npm

npm i evelodb

Manual Installation

  • Download evelodb.js
  • Place it in your project directory
  • First run creates ./evelodatabase/ automatically

Import

const eveloDB = require('evelodb')
const db = new eveloDB();

Operations

Create

// Structure
db.create('collection', {
    key: 'value'
});

// Example
db.create('collection', {
    username: 'evelocore',
    name: {
        firstname: 'Kumuthu',
        lastname: 'Prabhasha'
    },
    email: 'example@gmail.com'
});

Find

// Structure
const result = db.find('collection', {
    key: 'value'
});

// Example
const user = db.find('collection', {
    username: 'evelocore'
});
console.log(user)

Output

[
  {
    username: 'evelocore',
    name: 'Evelocore',
    developer: 'K.Prabhasha',
    email: 'example@gmail.com'
  }
]

Search

// Structure
const result = db.search('collection', {
    key: 'partial_value'
});

// Example
const user = db.search('collection', {
    username: 'evelo'
});
console.log(user)

Output

[
  {
    username: 'evelocore',
    name: 'Evelocore',
    developer: 'K.Prabhasha',
    email: 'example@gmail.com'
  }
]

Check Existence

// Structure
const exists = db.check('collection', {
    key: 'value'
});

// Example
const exists = db.check('accounts', {
    username: 'evelocore'
});
console.log(exists)

Output

true

Update

// Structure
db.edit('collection', 
    { key: 'value' },     // find condition
    { key: 'new_value' }  // new data
);

// Example
db.edit('accounts', 
    { username: 'evelocore' },
    {
        name: 'EveloCore Official',
        email: 'updated@gmail.com'
    }
);

Delete

// Structure
db.delete('collection', {
    key: 'value'
});

// Example
db.delete('accounts', {
    username: 'evelocore'
});

Get full collection

// Structure
const result = db.get('collection');

// Example
const users = db.get('accounts');
console.log(users);

Inject full collection

// Structure
const result = db.inject('collection', data);

// Example
const users = db.inject('accounts', [
  { id: 1, name: 'Evelocore' },
  { id: 2, name: 'K.Prabhasha' },
]);

Reset Collection

// Structure
db.reset('collection');

// Example
db.reset('accounts');

Features

  • ✓ JSON-based storage
  • ✓ B-Tree indexing
  • ✓ Fast retrieval
  • ✓ Node.js only
1.0.9

7 months ago

1.0.8

7 months ago

1.0.6

11 months ago

1.0.5

11 months ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago