A simple JSON database for PXE.js.
Install @pxe/database.
# NPM
npm i @pxe/database vlds
# Yarn
yarn add @pxe/database vlds
These are all @pxe/database module methods, events and declarations.
Databasepath?: string: The database path.Create a database instance.
db.removecollectionName: string: The name of the collection to be removed.Remove a collection from the database.
db.clearClear the database.
db.collectT: The collection type.name: string: The collection name.validator: valids.Validator: A type validator from package vlds.Create a new database collection.
The class returns by db.collect.
Collectiondata: T: The data.Create an object with the specified value if validate successfully.
item.saveSave or resave the collection to the database.
item.delDelete the collection from the database.
item.setValuevalue: T: Value to be set to the collection.Set the value to the collection and save to the database.
Collection.removeid: string: ID of object to be removed.Delete object from collection by ID.
Collection.removeAllo: any: Key that will be matched to objects.count?: number: Number of objects to be removed.Delete all objects the match o in the collection. Delete count objects if specified.
Collection.selectid: string: ID of object to be selected.Select a collection by ID.
Collection.findo: any: Key that will be matched to objects.count?: number: Number of objects to be removed.Find a collection that matches o. Find count number of collections if specified.
Collection.findOneo: any: Key that will be matched to objects.Find a single colelction that matches o.
Collection.updateo: any: Key that will be matched to objects.value: T: Value to update the collection with.rewrite?: boolean: Overwrites the object when true.Update the first collection that matches o with the new value.
Collection.updateIDid: string: ID of object to be updated.value: T: Value to update the collection with.rewrite?: boolean: Overwrites the object when true.Update an item by its ID.
Update a collection by ID with the new value.
db.pathstringThe specified database path. Can be undefined.