Skip to content

A database created by simplifying Enmap technology for Kharoh Family uses

Notifications You must be signed in to change notification settings

Kharoh/KF-Database

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KF-Database

A simple database sqlite driven for kf games and more.

Getting Started

How to install KF-Database npm package

Prerequisites

Simply type in the npm package command installer

npm install kf-database --save

Create the database

Initialize the database

To run the database, you need to call the constructor with the following params

const Base = require('kf-database')

const database = new Base({ name: 'Your_Database_Name' })

Use the database

The methods

fetchEverything

Retrieve all the data from sqlite database and push it in the Map object

database.fetchEverything()

get

Get a value from the Map object given the key and a path if it is an object
Note : path is optional, key has to be a string or a number, path needs to be following the model of lodash path

database.get('key', 'path')

ensure

Get a value from the Map object given the key and a path if it is an object, if the value is undefined, return the defaultValue
Note : path is optional, key has to be a string or a number, path needs to be following the model of lodash path
Note : returning the defaultValue will modify the database

database.ensure('key', 'defaultValue', 'path')

set

Set a value in the Map object given the key and a path if it is an object, will modify the database
Note : path is optional, key has to be a string or a number, path needs to be following the model of lodash path
Note : giving a path when the current value is not an object will erase the current value to create an object

database.set('key', 'value', 'path')

delete

Delete a value in the Map object given the key and the path if it is an object
Note : path is optional, key has to be a string or a number, path needs to be following the model of lodash path

database.delete('key', 'path')

deleteAll

Delete all values from the Map object

database.deleteAll()