All files drivers.ts

85.71% Statements 12/14
72.72% Branches 8/11
50% Functions 2/4
84.61% Lines 11/13

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 281x     1x   36x     36x 36x 36x 1x 1x 1x                   1x     1x  
import DatabaseDriver from "./database";
import IConnectionConfig, { BaseConfig, CustomDriverConfig } from './IConfig';
 
export default class Drivers<T> extends DatabaseDriver{
 
    protected regex = /(\d+(\.\d+)+-\d+|\d+(\.\d+)+)/;
 
    constructor(type: T, config: IConnectionConfig<T>){
        super(type, config as BaseConfig);
        console.log(type);
        if(type === 'custom'){
            console.log('Custom driver');
            const _config = config as CustomDriverConfig;
            this.set_driver({
                jar: _config.jars.split('/').pop() || _config.jars,
                className: _config.driverClass,
                connectionType: _config.driverClass.split('.')[1],
                version: _config.jars.match(this.regex)?.[1] || '',
                query:{
                    columns: tableName => '',
                    describe: tableName => '',
                } 
            })
            this.set_driver_path(_config.jars)
        }
    }
}