@fibjs/pool

1.0.0 • Public • Published

@fibjs/pool

pool module for fibjs.

This module can be used to implement db connection pool or other situation like this.

Usage

const pool = require('@fibjs/pool');
const db = require('db');

const sqlConnString = 'mysql://root:123456@localhost/test';
const ConnPool =  Pool(() => db.open(config), 20, 10000);

const apps = ConnPool(conn => {
    const sql = "select * from apps where appid = ? and version = ?";
    const appid = 2;
    const version = '2.3.0';
    return conn.execute(sql, appid, version);
});

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i @fibjs/pool

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • ngot
  • ngot-fibjs