npm install fib-pool [--save]
npm run ci
Simple example.
var db = require("db");
var Pool = require("fib-pool");
var p = Pool(() => {
return db.open("sqlite:test.db");
});
Specify maxsize and timeout.
var db = require("db");
var Pool = require("fib-pool");
var p = Pool(() => {
return db.open("sqlite:test.db");
}, 10, 30 * 1000);
Specify custom destroy function.
var db = require("db");
var Pool = require("fib-pool");
var p = Pool({
create: () => {
return db.open("sqlite:test.db");
},
destroy: (o) => {
o.close()
},
timeout: 30 * 1000,
retry: 3
});
var db = require("db");
var Pool = require("fib-pool");
var p = Pool({
create: () => {
return db.open("sqlite:test.db");
},
destroy: (o) => {
o.close()
},
timeout: 30 * 1000,
retry: 3
});
var res = p((conn) => {
conn.execute("select * from test");
});
var db = require("db");
var Pool = require("fib-pool");
var p = Pool({
create: (name) => {
return db.open("sqlite:" + name + ".db");
},
destroy: (o) => {
o.close()
},
timeout: 30 * 1000
});
var res = p("test", (conn) => {
conn.execute("select * from test");
});
Simple example.
var db = require("db");
var Pool = require("fib-pool");
var p = Pool(() => {
return db.open("sqlite:test.db");
});
p.clear();