@edu-tosel/mysql2-handler
TypeScript icon, indicating that this package has built-in type declarations

0.5.7 • Public • Published

mysql2-handler

The custom handler for mysql2 module.

Installation

npm install @edu-tosel/mysql2-handler

Environment Variables

export DB_HOST='localhost'
export DB_USER='root'
export DB_PASSWORD='password'
export DB_NAME='database'
export DB_PORT='3306'
export DATE_STRINGS='DATE' # or 'DATETIME' or 'TIMESTAMP'
# ...export DATE_STRINGS='DATETIME'
export CONNECTION_LIMIT='10'
export CASTED_BOOLEAN='true' # or 'false'

Default configuration

  • DB_HOST: None
  • DB_USER: None
  • DB_PASSWORD: None
  • DB_NAME: None
  • DB_PORT: 3306
  • DATE_STRINGS: 'DATE'
  • CONNECTION_LIMIT: 5
  • TIMEZONE: 'UTC'
  • CASTED_BOOLEAN: false

Usage

const mysqlHandler = require("@edu-tosel/mysql2-handler");
function select1() {
  return mysqlHandler.handler(async (connection) => {
    const [rows, fields] = await connection.execute("SELECT 1 AS `one`");
    return rows; // [{one: 1}]
  });
}
select1().then(console.log).catch(console.error); // stdout: [{one: 1}]

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.5.75latest

Version History

VersionDownloads (Last 7 Days)Published
0.5.75
0.5.62
0.5.5-hotfix0
0.5.50
0.5.42
0.5.20
0.5.10
0.5.00
0.4.170
0.4.160
0.4.150
0.4.140
0.4.130
0.4.110
0.4.100
0.4.90
0.4.80
0.4.70
0.4.60
0.4.51
0.4.40
0.4.30
0.4.2-30
0.4.2-20
0.4.2-10
0.4.20
0.4.10
0.4.00
0.3.90
0.3.80
0.3.70
0.3.60
0.3.50
0.3.40
0.3.30
0.3.20
0.3.10
0.3.00
0.2.50
0.2.40
0.2.30
0.2.20
0.2.10
0.2.00
0.1.70
0.1.60
0.1.50
0.1.40
0.1.30
0.1.20
0.1.10
0.1.00

Package Sidebar

Install

npm i @edu-tosel/mysql2-handler

Weekly Downloads

10

Version

0.5.7

License

MIT

Unpacked Size

30.3 kB

Total Files

13

Last publish

Collaborators

  • park_jonghyeok
  • shrobin
  • jaegyeom
  • minhyeong
  • bingha
  • tosel