@made-simple/sqlite-store
v1.3.2
Published
Makes use of Keyv to make an even easier SQLite that also cares about dev/prod environments
Downloads
22
Maintainers
Readme
Simple Logging
Using Keyv to store data even easier with SQLite with care for development environments. Extending the functionality of Keyv to copy data from one store to another and wipe development data.
Also with optional typings for what is store in the database, reconciliation, fallbacks, error reverting, and more.
Keyv naturally uses async/await
but this package does not.
Installation
npm install @made-simple/sqlite-store
Example Usage
const Store = require('@made-simple/sqlite-store');
const template = {
foo: "bar",
bar: 6
}
const store = new Store<typeof template>("path/to/database");
store.reconcile(template);
store.set("foo", "bar");
store.get("bar", 6); // will be 6 if not found, this will be set in the database too
store.copyFrom(store2, true) // 2nd argument is if it should start from a clean store
store.copyKey(store2, "foo", "bar") // attempts to copy the key foo from store2 to store, if not found, it will set it to bar
License
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Repository