New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

quickpostgres

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

quickpostgres

An easy, beginner-friendly PostgreSQL database wrapper similar to quick.db.

Source
npmnpm
Version
3.0.0-dev.1668439585.3faa779
Version published
Weekly downloads
26
-55.17%
Maintainers
1
Weekly downloads
 
Created
Source

Quickpostgres

Test NPM Publish (Release) NPM Publish (Dev)

An easy, beginner-friendly PostgreSQL database wrapper similar to quick.db.

Features

  • Near identical syntax to quick.db
  • Never worry about constant database corruptions again
  • Fully flexible, uses pg internally
  • Relies on ES6 promises (async/await, .then())

If you don't know about quick.db, quickpostgres also has:

  • Persistent storage - all data is stored on your PostgreSQL database
  • Easy to setup - All you need is a PostgreSQL database to setup
  • Beginner friendly - Use simple syntax with dot notation
  • No learning curve - 0 learning curve if you're coming from quick.db or quickmongo

Installation

You can easily install quickpostgres using your preferred package manager.

npm install quickpostgres
# or
yarn add quickpostgres
# or
pnpm add quickpostgres

Requirements

  • Node.js 14 or above
  • A PostgreSQL database

Usage

Quickpostgres has similar (if not almost identical) syntax to quick.db. You can refer to their documentation if you are getting stuck.

Note: Quickpostgres is built on top of promises, meaning you need to resolve them first using .then() or await to get their returned data.

// Import quickpostgres
const { Client } = require("quickpostgres");

// Create a new client using the default values on localhost
const dbUrl = "postgresql://postgres:<password>@localhost:5432/postgres";
const db = new Client(dbUrl);

(async () => {
  // Connect to your client
  await db.connect();

  // Setting an object in the database:
  await db.set("userInfo", { difficulty: "Easy" });
  // => { difficulty: "Easy" }

  // Pushing an element to an array (that doesn't exist yet) in an object:
  await db.push("userInfo.items", "Sword");
  // => { difficulty: "Easy", items: ["Sword"] }

  // Adding to a number (that doesn't exist yet) in an object:
  await db.add("userInfo.balance", 500);
  // => { difficulty: "Easy", items: ["Sword"], balance: 500 }

  // Repeating previous examples:
  await db.push("userInfo.items", "Watch");
  // => { difficulty: "Easy", items: ["Sword", "Watch"], balance: 500 }
  await db.add("userInfo.balance", 500);
  // => { difficulty: "Easy", items: ["Sword", "Watch"], balance: 1000 }

  // Fetching individual properties
  await db.get("userInfo.balance"); // => 1000
  await db.get("userInfo.items"); // ["Sword", "Watch"]

  // End the database connection
  await db.end();
})();

Support

For now, please use GitHub discussions if you need any support.

I may consider opening a Discord support server soon, but this is not guranteed.

Contributing

You must adhere to the code of conduct when interacting within the quickpostgres repository.

If you spot a bug or you have a feature request, please open a GitHub issue, or if you'd like to write some code, you can open a pull request.

If you spot a security vulnerability, please contact me.

Notes

  • Some users consider quick.db non-suitable in the long term, reason being it uses SQLite, and is not easily scalable. However, since quickpostgres uses PostgreSQL, one of the best production-grade database system out there, quickpostgres is suitable for production usage, in terms of performance.
  • Quickpostgres is meant for beginners, and uses a JSON-feeling database. If you want to use the full advantages of PostgreSQL, we highly recommend you switching to something else.

License

Apache License 2.0

Keywords

easy

FAQs

Package last updated on 14 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts