
Security News
/Research
Popular node-ipc npm Package Infected with Credential Stealer
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.
@alemonjs/db
Advanced tools
提供 Redis 和 Sequelize 连接。
当前 SQL 方言支持:
pgsqlmysqlsqliteimport { getIoRedis, getSequelize } from '@alemonjs/db';
export const Redis = getIoRedis();
export const sequelize = getSequelize();
yarn add @alemonjs/db -W
@alemonjs/db 不再内置 SQL 驱动。
如果你要使用 SQL 能力,需要按实际方言额外安装对应包:
# PostgreSQL
yarn add pg -W
# MySQL
yarn add mysql2 -W
# SQLite
yarn add sqlite3 -W
dialectconst sequelize = getSequelize({
dialect: 'pgsql'
});
优先级最高。
warnsqlitesqlite3 也未安装,则提示当前环境无法使用 SQL 能力db.dialectdb:
dialect: pgsql
语义与代码显式指定一致:
warnsqlitesqlite3 也不可用,则提示无法使用dialect框架会自动探测:
pgsqlmysqlsqlite如果一个可用 SQL 驱动都没有,则提示安装:
pgmysql2sqlite3db:
dialect: pgsql
pgsql:
host: '127.0.0.1'
port: 5432
user: 'postgres'
password: 'Postgres123456!'
database: 'alemonjs'
redis:
host: '127.0.0.1'
port: 6379
password: ''
db: 0
db:
dialect: mysql
mysql:
host: '127.0.0.1'
port: 3306
user: 'root'
password: 'Mysql123456!'
database: 'alemonjs'
db:
dialect: sqlite
sqlite:
storage: './data/alemonapp.db'
import { getSequelize } from '@alemonjs/db';
export const sequelize = getSequelize({
dialect: 'pgsql'
});
如果你明确写了 dialect: 'pgsql',但没有安装 pg,框架会:
sqlitesqlite3 也未安装,则提示无法使用 SQL 能力Redis 仍然内置使用 ioredis,不需要额外安装驱动。
FAQs
The npm package @alemonjs/db receives a total of 141 weekly downloads. As such, @alemonjs/db popularity was classified as not popular.
We found that @alemonjs/db demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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.

Security News
/Research
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.

Security News
TeamPCP and BreachForums are promoting a Shai-Hulud supply chain attack contest with a $1,000 prize for the biggest package compromise.

Security News
Packagist urges PHP projects to update Composer after a GitHub token format change exposed some GitHub Actions tokens in CI logs.