datadoodle
v0.0.15
Published
Local data storing and usage
Readme
DATA DOODLE
This is a simple module to store data locally and manage it. It is a simple key-value store.
Disclaimer
This is a simple project, the current state of it is not production ready. It is a simple key-value store that stores data in a JSON file. It is not recommended to use this in a production environment.
Example usage
import { DataObject } from 'datadoodle';
const Player = (data?: PlayerTypes.PlayerData) => new DataObject<PlayerTypes.PlayerData>('Player', 'id', data);
// Save a player
const player = Player().build({ name: 'John Doe', level: 1 });
await player.save();
// Load a player
const player = await Player().load('<id>');
console.log(player.data);
// Find a player
const player = await Player().find({ name: 'John Doe' }));
console.log(player.data);
// Load all players
const players = await Player().loadAll();
console.log(players);
// Delete a player
await player.delete();Env Variables
To set a custom path for the database folder, set the DATABASE_FILE_LOCATION environment variable.
Contribution
Feel free to contribute to this project. If you have any ideas or suggestions, feel free to open an issue or a pull request.
https://gitlab.com/hugo18/datadoodle
