1.3.0 • Published 1 year ago

myag.db v1.3.0

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Myag

Myag is a simple database implementation in JavaScript/TypeScript that allows you to store data using either JSON or SQLite.

Installation

You can install the package:

npm install myag.db
or 
ban install myag.db

Usage

const { Myag } = require('myag.db');

// Create a new Myag instance with JSON storage
const myag = new Myag({
    path: './data/database',
    useJson: true
});

// Set a value
await myag.set('key', 'value');

// Get a value
const result = await myag.get('key');
console.log(result);

// Delete a value
await myag.delete('key');

API

Myag(options)

Creates a new Myag instance.

  • options (object): Configuration options for the Myag instance.
    • path (string): The path where the database will be stored.
    • useJson (boolean): Set to true to use JSON storage, and false to use SQLite.

Myag.set(key, value)

Sets a value in the database.

  • key (string): The key to set.
  • value (any): The value to set.

Myag.get(key)

Gets a value from the database.

  • key (string): The key to retrieve.

Myag.delete(key)

Deletes a value from the database.

  • key (string): The key to delete.

Myag.push(key, value)

Pushes a value to an array in the database.

  • key (string): The key of the array.
  • value (any): The value to push.
1.3.0

1 year ago

1.2.0

1 year ago

1.1.0

1 year ago

1.0.0

1 year ago