Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
knex-serverless-mysql
Advanced tools
Minimalistic knex.js dialect for serverless-mysql.
serverless-mysql persists database connections across multiple AWS Lambda function execution contexts. This reduces the load on the database. However, this client is not natively supported by Knex. This library solves the problem.
yarn add knex-serverless-mysql
# or
npm install knex-serverless-mysql
const Knex = require('knex');
const knexServerlessMysql = require('knex-serverless-mysql');
const mysql = require('serverless-mysql')({
config: {
host : process.env.DB_HOST,
database : process.env.DB_DATABASE,
user : process.env.DB_USERNAME,
password : process.env.DB_PASSWORD,
},
});
const knex = Knex({
client: knexServerlessMysql,
mysql,
});
exports.run = function () {
return knex('table_name').where('id', 1);
}
const Knex = require('knex');
const knexServerlessMysql = require('knex-serverless-mysql');
const { SQLDataSource } = require('datasource-sql');
const mysql = require('serverless-mysql')({
config: {
host : process.env.DB_HOST,
database : process.env.DB_DATABASE,
user : process.env.DB_USERNAME,
password : process.env.DB_PASSWORD,
},
});
const knex = Knex({
client: knexServerlessMysql,
mysql,
});
class TableNameDataSource extends SQLDataSource {
getRowById(id) {
return this.knex('table_name').where('id', id);
}
}
const dataSource = new TableNameDataSource(knex);
exports.run = function () {
return dataSource.getRowById(1);
}
All contributions are welcome!
Please open an issue or pull request.
FAQs
Knex.js dialect for serverless-mysql
The npm package knex-serverless-mysql receives a total of 777 weekly downloads. As such, knex-serverless-mysql popularity was classified as not popular.
We found that knex-serverless-mysql 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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.