New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

egg-cockroach

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

egg-cockroach

A CockroachDB plugin for eggjs.

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

egg-cockroach

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

  • A cockroachdb plugin of eggjs.
  • GitHub

Direction

egg version

egg-cockroachegg 2.x
2.x😁

Get

$ npm install egg-cockroach --save

Open Plugin

// config/plugin.js
exports.cockroach = {
  enable: true,
  package: 'egg-cockroach',
};

Config

exports.cockroach = {
  client: {
    user: 'root',
    host: '127.0.0.1',
    database: 'user',
    port: 26257,
  },
  app: true,
  agent: false,
};

Using

// controller/home.js
// it is can only execute SQL  Statements now.
class HomeController extends Controller {
  async index() {
    const [err, conn, done] = await this.app.cockroach;
    if(err) {
      console.log(err);
    } else {
      const time = await conn.query('select now() as currentTime;');
      console.log(time.rows[0].currenttime);
      const res = await conn.query('SELECT * FROM accounts;');
      console.log(res);
      await done();
    }
    this.ctx.body = 'hi, egg';
  }
}

Q & A

egg-cockroach issues

License

MIT

Keywords

egg

FAQs

Package last updated on 12 May 2018

Did you know?

Socket

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