Fibjs Wrapper For Knexjs
Introduction
One fibjs wrapper for knex
, which is designed for NodeJS
and Browser
.
Pre-requisite
There's no built-in knex
in this package's dependencies, for purpose that you can use any valid version knex
as you like
if use typescript, install types to enable typo lint:
APIs
cjs: Wrapped Knex
You can get Wrapped Knex safely like this:
const FKenx = require('@fxjs/knex')
assert.property(FKenx, 'SandBox')
Distinguished with the original knex
package, fibjs version one has more properties:
SandBox
: one SandBox class extended from vm.SandBox, which has required modules on which knex
run in fibjs;
Use FKenx.SandBox
to customized your own SandBox
There's only necessary modules for knex
in built-in sandbox
, you can customized your own sandbox by create one SandBox
instance. Just use FKenx.SandBox
as fibjs's built-in vm.SandBox
like this:
const FKenx = require('@fxjs/knex')
const vbox = new FKenx.SandBox(
{
a: AMOD,
b: BMOD,
uuid: require('uuid')
},
(name) => require(name),
{
}
)
All reserved modules would NOT been overwritten by the ones user passing, they are:
fs
path
os
url
tty
util
events
assert
crypto
uuid
LICENSE
MIT
Copyright (c) 2018-present, Richard