elegantdb
TypeScript icon, indicating that this package has built-in type declarations

2.0.2 • Public • Published

Node.js Package Socket.dev CodeQL NPM

Elegant Database

Elegant Database is a JavaScript library that provides advanced features for managing and interacting with a database. It supports both JSON and Elegant (Custom Adaptor of ElegantDB) adaptors for storage.

Installation

You can install Elegant Database using npm:

npm install elegantdb

Usage

Import the necessary components from the library:

import { Database, JSONAdaptor, ElegantAdaptor } from 'elegantdb';

Create an instance of the Database class with appropriate options:

const db = new Database({
  adaptor: new JSONAdaptor(), // or new ElegantAdaptor()
  path: './my-database.json', // Optional, specify the path
  disableCheckUpdates: false, // Optional, disable update checks
  useExperimentalCaches: false // Optional
});

Database Adaptors

  • JSONAdaptor: JSON adaptor | database.json
  • ElegantAdaptor: Custom Adaptor of ElegantDB | database.elegant

Methods

  • set(key, value): Set a value in the database.
  • add(key, value): Add a value in the database.
  • get(key): Get a value from the database.
  • has(key): Check if a key exists in the database.
  • remove(key): Remove a key from the database.
  • clone(): Create a clone of the database instance.
  • all(): Get All Data from Adaptor.
  • getCache(): Get All Cache from Database

Contributing

If you encounter any issues or have suggestions for improvements, please feel free to open an issue on GitHub.

Versioning

We use Semantic Versioning for versioning. See the latest releases on npm.

License

This project is licensed under the ISC License.


Please feel free to copy and paste this template into your repository's README file. Make sure to review it and adjust any formatting or content as needed to fit your preferences.

Package Sidebar

Install

npm i elegantdb

Weekly Downloads

42

Version

2.0.2

License

ISC

Unpacked Size

46.4 kB

Total Files

22

Last publish

Collaborators

  • nicatdcw