@microfleet/plugin-knex
TypeScript icon, indicating that this package has built-in type declarations

6.0.1 • Public • Published

Microfleet Knex Plugin

Adds Knex support to microfleet. This can be used to interact with *SQL databases

Install

yarn add @microfleet/plugin-knex

Configuration

To make use of the plugin adjust microfleet configuration in the following way:

interface Config {
  debug?: boolean;
  client?: string | typeof Client;
  dialect?: string;
  version?: string;
  connection?:
    | string
    | ConnectionConfig
    | MariaSqlConnectionConfig
    | MySqlConnectionConfig
    | MsSqlConnectionConfig
    | OracleDbConnectionConfig
    | Sqlite3ConnectionConfig
    | SocketConnectionConfig;
  pool?: PoolConfig;
  migrations?: MigratorConfig;
  postProcessResponse?: (result: any, queryContext: any) => any;
  wrapIdentifier?: (
    value: string,
    origImpl: (value: string) => string,
    queryContext: any
  ) => string;
  seeds?: SeedsConfig;
  acquireConnectionTimeout?: number;
  useNullAsDefault?: boolean;
  searchPath?: string | string[];
  asyncStackTraces?: boolean;
  log?: Logger;
}

// make sure to add this to the list of loadable plugins
exports.plugins = [
  ...,
  'knex',
  ...
]

// knex configuration
exports.knex: Config = { ... }

Interface

Microfleet Knex Plugin extends service interface with the following methods:

service.knex: Knex

Initialized instance. Look at the docs here - http://knexjs.org/

Readme

Keywords

none

Package Sidebar

Install

npm i @microfleet/plugin-knex

Weekly Downloads

106

Version

6.0.1

License

MIT

Unpacked Size

15.2 kB

Total Files

15

Last publish

Collaborators

  • avvs
  • torinasakura