const mysql = require('mysql')
const qBuilder = require('./QueryBuilder')

let query = ''
let params = []

module.exports = (dbSetting) => {
  let connection = mysql.createConnection({
    host: dbSetting.hostname,
    user: dbSetting.username,
    password: dbSetting.password,
    database: dbSetting.database
  })

  connection.connect()

  return {
    makeQuery: () => {
      return qBuilder
    },
    prepare: () => {
      query = qBuilder.prepare()
    },
    setParameters: (params) => {
      qBuilder.setParameters(params)
    },
    getParameters: () => {
      params = qBuilder.getParameters()
    },
    execute: () => {
      // connection.query(query)
    },
    get: () => {

    }
  }
}

const mysql = require('mysql')
const qBuilder = require('./QueryBuilder')

let _query = ''
let _params = []

module.exports = (dbSetting) => {
  let connection = mysql.createConnection({
    host: dbSetting.hostname,
    user: dbSetting.username,
    password: dbSetting.password,
    database: dbSetting.database
  })

  return {
    makeQuery: () => {
      return qBuilder
    },
    prepare: () => {
      _query = qBuilder.prepare()
    },
    setParameters: (params) => {
      _params = params
      qBuilder.setParameters(params)
    },
    getParameters: () => {
      _params = qBuilder.getParameters()
    },
    execute: () => {
      // connection.query(_query)
    },
    get: () => {

    },
    connectToDatabase: () => {
      connection.connect()
    },
    endConnection: () => {
      connection.end()
    }
  }
}

Add few functions and connect to query builder
Add few functions and connect to query builder
