Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zastinian/hedystia.db-rs
A database made by the company hedystia developed in Rust, easy to use
https://github.com/zastinian/hedystia.db-rs
database db discord discordjs easy encrypted hedystia javascript json typescript
Last synced: 27 days ago
JSON representation
A database made by the company hedystia developed in Rust, easy to use
- Host: GitHub
- URL: https://github.com/zastinian/hedystia.db-rs
- Owner: Zastinian
- Created: 2024-05-19T15:59:25.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2024-06-05T03:09:13.000Z (5 months ago)
- Last Synced: 2024-10-12T03:20:29.664Z (27 days ago)
- Topics: database, db, discord, discordjs, easy, encrypted, hedystia, javascript, json, typescript
- Language: Rust
- Homepage: https://www.npmjs.com/package/@hedystia/db-rs
- Size: 21.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
## Installation
```
npm i @hedystia/db-rsyarn add @hedystia/db-rs
```## Nodejs Version
- `v18.0.0` or higher
## Links
- [Discord](https://discord.gg/aXvuUpvRQs) [Hedystia Discord]
- [Discord_Bot](https://hedystia.com) [Hedystia Bot]
- [Docs](https://docs.hedystia.com/dbrs/start) [Hedystia Docs]## Example
```js
const Database = require("@hedystia/db-rs");// Create a file named database.ht and enter the password
const database = new Database("./database.ht", "password");// You can only use it once to create the table after that you can no longer use it.
database.createTable("users", ["id", "name", "email"]);database.insert("users", { id: "1", name: "John Doe", email: "[email protected]" });
database.insert("users", { id: "2", name: "María", email: "[email protected]" });
const users = database.select("users");
console.log("----------------------------------");
console.log(users);
database.addColumn("users", "phone");
database.addColumn("users", "lang", "en-US");
const newUsersPhone = database.select("users");
console.log("----------------------------------");
console.log(newUsersPhone);
database.deleteColumn("users", "phone");
const oldUsersPhone = database.select("users");
console.log("----------------------------------");
console.log(oldUsersPhone);
const userJohn = database.select("users", { name: "John Doe" });
console.log("----------------------------------");
console.log(userJohn);
database.delete("users", { name: "María" });
const users2 = database.select("users");
console.log("----------------------------------");
console.log(users2);
database.update("users", { id: "1" }, { name: "Jane Doe", lang: "es-ES" });
const users3 = database.select("users");
console.log("----------------------------------");
console.log(users3);
```## Functions
| Function | Description |
| ------------------------ | ---------------------------------------------- |
| `readTables` | To read the tables from the database |
| `createTable` | To create a table |
| `deleteTable` | To delete a table |
| `createTableIfNotExists` | To create a table if it does not exist |
| `deleteTableIfExists` | To delete a table if it exists |
| `addColumn` | To add a column to an already created table |
| `deleteColumn` | To remove a column to an already created table |
| `insert` | To insert a data in the table |
| `update` | To update a data in the table |
| `select` | To search for information in a table |
| `delete` | To delete a data from the table |