@fxjs/orm-plugin-pool
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

orm-plugin-pool

NPM version

Pool Plugin for @fxjs/orm

Installation

fibjs --install @fxjs/orm @fxjs/orm-plugin-pool

Usage

const ORM = require('@fxjs/orm');
const ORMPluginPool = require('@fxjs/orm-plugin-pool')

const definitions = [
    (orm) => {
        orm.define('user', {}, {})
    },
    (orm) => {
        orm.define('role', {}, {})
    }
]

const pool = ORM.getPool({
    connection: 'sqlite:test.db',
    definitions: definitions,

    maxszie: 10,
    timeout: 1000,
    retry: 3
});

pool(orm => {
    orm.user.createSync({/* ... */})
});

or use it as plugin

const ORM = require('@fxjs/orm');
const ORMPluginPool = require('@fxjs/orm-plugin-pool')

const orm = ORM.connectSync('sqlite:test.db');

// use it to enable `orm.$pool`
orm.use(ORMPluginPool, {
    definitions: definitions,
    maxszie: 10,
    timeout: 1000,
    retry: 3
});

orm.$pool(orm => {
    orm.user.createSync({/* ... */})
})

Readme

Keywords

none

Package Sidebar

Install

npm i @fxjs/orm-plugin-pool

Weekly Downloads

1

Version

1.0.0

License

ISC

Unpacked Size

4.84 kB

Total Files

4

Last publish

Collaborators

  • asion
  • richardo2016