import { KnexModuleOptions } from './knex.interfaces' ; import { knex } from 'knex' ; import { KNEX_MODULE_CONNECTION , KNEX_MODULE_CONNECTION_TOKEN , KNEX_MODULE_OPTIONS_TOKEN , } from './knex.constants' ; export function getKnexOptionsToken ( connection ) { return `${ connection || KNEX_MODULE_CONNECTION }_${ KNEX_MODULE_OPTIONS_TOKEN }` ; } export function getKnexConnectionToken ( connection ) { return `${ connection || KNEX_MODULE_CONNECTION }_${ KNEX_MODULE_CONNECTION_TOKEN }` ; } export function createKnexConnection ( options ) { const { config } = options ; return knex ( config ) ; }