Package Exports
- st.db
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (st.db) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
ST.db
- Simple, Fast JSON Database & You can read data from project to project
Features
- Multiple JSON Files
- Simple and Easy To get started
- System for reading data from one project to another
Getting Started
You can start install the package on your project:
npm i st.db@latestYou can update to a newer version to receive updates using npm.
npm st.db music.botThen Start define it like this:
const Database = require('st.db')
const db = new Database('FileName')//You can write the name you wantImportant Notes
- Auto understands json without typing .json in the path
- For the Database class, you can pass in a parameter to set a file rather than using the default file!
- If the file dosen't exist, it will create it
- Path automatically set to ./
Set / Push Functions Examples
var object1 = {name: "Shuruhatik#0001", id: 742070589212327947}
db.set('Profile', object1); /* Profile: {name: "Shuruhatik#0001", id: 742070589212327947} */
var example1 = ['eg', 'ps']
db.set('Array', example1); /* example1: ['eg', 'ps'] */Get / All Functions
db.get('profile'); // Get the value of the data
db.all(); // Fetches everything in the databaseRemove Function
db.remove('Array', 'element3'); // Removing something from an array using value/indexClear Function
db.clear(); // Clears everything from the databaseMaths Functions
- You must have a registered number in order to perform the calculation
var newEco = db.math("credits", "+", 10); // Adds 10 to the data (without set it), You Can Use [+,-,*,/]
db.set(`credits`, newEco) // set "credits": 5Multiple Files
- Example
const { Database } = require('st.db');
const bot = new Database('bot-config');
const servers = new Database('servers-config');
const users = new Database('users');
servers.set('guilds', '800060636041314375'); // servers-config.st file
bot.set('prefix', '$'); // bot-config.st file
users.set('blacklist_742070589212327947', true); // users.st fileSystem for reading data from one project to another
- The data you record is stored in your own api, and the api is like that
http://localhost/FilenamelocalhostType in the URL for your projectFilenameType the filename without the folder extension and without the json syntax
https://YouName.ProjectName.repl.co/Filename- Here is an example URL for
repl it
How can I read data in another project?
- Very simply, you are now data that has become an api, which you can read what is in it using the
fetchpackage
Any bug or suggestion !
- Contact With Me Discord: Shuruhatik#0001
- or Discord Server ST Studio
