Skip to content

fibjs-modules/pool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@fibjs/pool

Build Status

pool module for fibjs.

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

Installation

  npm install @fibjs/pool --save

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

About

pool module for fibjs.

Resources

License

Stars

Watchers

Forks

Packages

No packages published