elegantdb
v2.0.2
Published
✨ Faster and Useful Database and Database Group.
Downloads
23
Maintainers
Readme
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.jsonElegantAdaptor
: 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.