
Research
/Security News
Popular Tinycolor npm Package Compromised in Supply Chain Attack Affecting 40+ Packages
Malicious update to @ctrl/tinycolor on npm is part of a supply-chain attack hitting 40+ packages across maintainers
/bəˈdeɪgə/
noun: bodega; plural noun: bodegas
A cellar or shop selling wine and food,
especially in a Spanish-speaking country or area.
A simple wrapper for node-postgres to make your life even easier. You do not need to worry about which connection to use, about pooling or about returning a client/connection to the pool after using it.
There is no need to additionally install node-postgres
. Bodega will take care of it. If you need more information/details on the actual node-postgres
module, take a look at its own repository.
Install your bodega
:
npm install bodega
Require your bodega
and open it:
var bodega = require('bodega').open(config);
The config
object requires these properties:
user
- Your DB username
(string).password
- Your DB password
(string).database
- The database
you are trying to connect to (string).Optional properties:
host
- The host
where your DB is to be found. (string, default: localhost
).port
- The port
on which your DB is listening. (int, default: 5432
).ssl
- Whether to use an SSL connection or not. (boolean, default: false
).bodega
var query = 'SELECT * FROM "Wine"';
bodega.do(query, function (err, data) {
if (err) {
throw err;
}
// Do something with your data
return data;
});
{
"rows": [],
"rowCount": int,
}
var query = 'INSERT INTO "Wine"("brand", "year") VALUES($1, $2) RETURNING id';
bodega.do(query, ['Quintanilla del Monte', '1980'], function (err, data) {
if (err) {
throw err;
}
// Do something with your data
return data.id;
});
{
"rows": [
{ "id": int }
],
"rowCount": int,
"id": int
}
The id
property is what's expected to be returned from the DB by using the RETURNING
syntax. Furthemore -to keep things easy and comfortable; if rows
contains only one object, then all of this object's properties will be mapped to the root, hence the presence of id
at root level.
var query = 'SELECT "insertWine"($1, $2) AS "bottle"';
bodega.do(query, ['Tempranillo de la Torre', '1980'], function (err, data) {
if (err) {
throw err;
}
// Do something with your data
return data.bottle;
});
{
"rows": [
{ "bottle": variable }
],
"rowCount": int,
"bottle": variable
}
In this case, the contents of the bottle
property will depend on what the stored procedure decides to return. The rest is the same as described above.
var query = 'DELETE FROM "Wine" WHERE "year" = $1';
bodega.do(query, ['1980'], function (err, data) {
if (err) {
throw err;
}
// Do something with your data
return data.rowCount;
});
{
"rows": [],
"rowCount": int
}
The rowCount
property will hold the number of deleted rows.
FAQs
A simple wrapper for node-postgres to make your life even easier.
The npm package bodega receives a total of 1 weekly downloads. As such, bodega popularity was classified as not popular.
We found that bodega demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
/Security News
Malicious update to @ctrl/tinycolor on npm is part of a supply-chain attack hitting 40+ packages across maintainers
Security News
pnpm's new minimumReleaseAge setting delays package updates to prevent supply chain attacks, with other tools like Taze and NCU following suit.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.