Socket
Socket
Sign inDemoInstall

egg-real-mysql

Package Overview
Dependencies
16
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    egg-real-mysql

based on node mysql and promise-mysql


Version published
Weekly downloads
1
Maintainers
1
Install size
3.75 MB
Created
Weekly downloads
 

Readme

Source

egg-real-mysql

NPM version build status Test coverage David deps Known Vulnerabilities npm download

Description

this plugin based on promise-mysql package, and promise-mysql based on node-mysql, so you can simply use it

the version on EggJs

egg-real-mysql versionegg 2.x
2.x😁
1.x
0.x

Install

$ npm i egg-real-mysql --save

Usage

// {app_root}/config/plugin.js
exports.realMysql = {
  enable: true,
  package: 'egg-real-mysql',
};

Configuration

// {app_root}/config/config.default.js
exports.mysql = {
    client: {
        host: '127.0.0.1',
        port: '3306',
        user: 'root',
        password: 'root',
        database: 'example',
    },
    app: true,
    agent: false,
};

see config/config.default.js for more detail.

use on service

module.exports = app => {
    return class extends app.Service {
        async create(name) {
            let data = {
                id: '',
                name: name
            };
            const result = await this.app.mysql.query('insert into list set ?', [ data ]).then(rows => {
                return JSON.parse(JSON.stringify(rows));
            });
            return result;
        }
    };
};

Questions & Suggestions

Please open an issue

License

MIT

Keywords

FAQs

Last updated on 07 Apr 2018

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc