This package has been deprecated

Author message:

WARNING: This project has been renamed to prisma.db. Install using prisma.db instead.

prism.db
TypeScript icon, indicating that this package has built-in type declarations

0.0.7 • Public • Published

Prism Database

Developed with 💙 by Roxza

An easy, open source database

npm version npm info

📦 Installation

npm i prism.db --save
yarn add prism.db

🔮 Importing

import snowApi from "prism.db"; // esm
const snowApi = require("prism.db"); // common

Different uses

Json

const { JsonDatabase } = require("prism.db");
const db = new JsonDatabase({ dbPath: "./db.json" });

Sqlite

const { sqliteDatabase } = require("prism.db");
const db = new sqliteDatabase({ dbPath: "./db.sqlite", dbName: "db" });

Yaml

const { YamlDatabase } = require("prism.db");
const db = new YamlDatabase({ dbPath: "./db.yaml" });

📝 Usage

/* Database Set and Push Example */

db.set("hello", "world"); /* String: World */

db.set("posts", [{ id: 1 }]); /* Array: [{ id: 1 }] */

db.push("posts", { id: 2 }); /* Array: [{ id: 1 }, { id: 2 }] */


/* Database Get and Fetch Example */

db.fetch("hello"); /* String: World */

db.get("posts"); /* Array: [{ id: 1 }, { id: 2 }] */

db.dataAll(); /* Object: { hello: "World", posts: [{ id: 1 }, { id: 2 }] } */

db.clear(); /* Object: {} */

db.destroy(); /* Object: {} */


/* Database Boolean Functions */

db.has("world"); /* Boolean: false */

db.has("posts"); /* Boolean: true */


/* Database Maths Functions */

db.set("a", 1);

db.add("a", 1); /* Number: 2 */

db.subtract("a", 1); /* Number: 1 */

📜 Multiple use

const { JsonDatabase } = require("prism.db");

const a = new JsonDatabase({ dbPath: "./a.json" });
const b = new JsonDatabase({ dbPath: "./b.json" });
const c = new JsonDatabase({ dbPath: "./c.json" });

a.set("a", 1); /* Number: 1 */
b.set("b", 2); /* Number: 2 */
c.set("c", 3); /* Number: 3 */

🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

💌 License

Webscreen is licensed under the [MIT License]. The terms of the license are as follows:

The MIT License (MIT)

Copyright (c) 2022 - Roxza

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Package Sidebar

Install

npm i prism.db

Weekly Downloads

1

Version

0.0.7

License

MIT

Unpacked Size

28.1 kB

Total Files

16

Last publish

Collaborators

  • roxza