Skip to content

Lebyy/quick.replit

Repository files navigation

Quick.Replit

Discord Version Documentation Maintenance License: AGPL--3.0

What is Quick.Replit?

A quick and easy wraper to interact with the replit database!

Features

  • 🧑 Beginner friendly
  • 🎉 Easy to use
  • 📦 Very similar to quick.db
  • 🚀 Import & export support
  • 🔑 Key value based
  • ✨ Simple
  • ⚙️ Asynchronous
  • 💥 Events: ready, error, debug
  • and much more!

📂 NPM

Install

npm install quick.replit

Usage

const { Database } = require("quick.replit");
const db = new Database(process.env.REPLIT_DB_URL)

//Set
db.set("foo", "bar").then(() => console.log("ID 'foo' is saved with the value 'bar'!"));

//Get
db.get("foo").then(data => {
  console.log(data) // Logs 'bar'
});

//Delete
db.delete("foo").then(() => console.log("ID 'foo' is deleted from the database!"));

//All
db.all().then(data => {
  console.log(data) // Logs all of the data with their key's in array form
});

//Add
db.add("foo", 1).then(() => console.log("Added +1 to ID 'foo'!"));
});

//Subtract
db.subtract("foo", 1).then(() => console.log("Subtracted 1 from ID 'foo'!"));
});

//Push
await db.set("foo", ["bar"]) // -> ["bar"]
await db.push("foo", "foo") // -> ["bar", "foo"]

//Pull
await db.pull("foo", "bar") // -> ["foo"]

//startsWith
db.startsWith("money", { sort: ".data" }).then(data => {
  console.log(data) // Logs all of the data present which starts with the ID 'money' in array form!
});

//Math
db.math("coins", "-", 30).then(() => console.log("Subtracted 30 coins!")); // operand: /, +, *, -, "add", "plus", "subtract", "minus", "mul", "multiply", "div", "divide"

//Ping
await db.ping() // Returns a object which contains the write, read, delete and average latencies!

//Has
db.has("foo").then(data => console.log(data)) // -> true || false

// Even more methods and events are listed in our documentation! Make sure to check them out at https://quickreplit.js.org

Author

👤 Lebyy

🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page. You can also take a look at the contributing guide.

Show your support

Give a ⭐️ if this project helped you!

Buy Me A Coffee Buy Me a Coffee at ko-fi.com

📝 License

Copyright © 2021 Lebyy.
This project is AGPL--3.0 licensed.