function init(cfg) {
  const conString = `mssql://${
    encodeURIComponent(cfg.username)
  }:${
    encodeURIComponent(cfg.password)
  }@${
    cfg.server
  }${(cfg.port) ? `:${cfg.port}` : ''
  }${(cfg.instance) ? `/${cfg.instance}` : ''
  }/${
    cfg.database
  }${(cfg.domain) ? `?domain=${cfg.domain}&encrypt=${cfg.encrypt}`
    : `?encrypt=${cfg.encrypt}`}`;
  return co(function* gen() {
    logger.info('Connecting to the database');
    connection = new cosql.Connection(conString);
    connection.on('error', err => this.emit('error', err));
    yield connection.connect();
    logger.info('Connection established');
  }.bind(this));
}
/**
 * This function will be called on component initialization
 *
 * @param cfg
 */
This function will be called on component initialization
@param cfg
This function will be called on component initialization @param cfg
function init(cfg) {
  const conString = `mssql://${
    encodeURIComponent(cfg.username)
  }:${
    encodeURIComponent(cfg.password)
  }@${
    cfg.server
  }${(cfg.port) ? `:${cfg.port}` : ''
  }${(cfg.instance) ? `/${cfg.instance}` : ''
  }/${
    cfg.database
  }${(cfg.domain) ? `?domain=${cfg.domain}&encrypt=${cfg.encrypt}`
    : `?encrypt=${cfg.encrypt}`}`;
  return co(function* gen() {
    logger.info('Connecting to the database');
    connection = new cosql.Connection(conString);
    connection.on('error', err => this.emit('error', err));
    yield connection.connect();
    logger.info('Connection established');
  }.bind(this));
}
function init ( cfg ) { const conString = ` ${ encodeURIComponent ( cfg . username ) } ${ encodeURIComponent ( cfg . password ) } ${ cfg . server } ${ ( cfg . port ) ? ` ${ cfg . port } ` : '' } ${ ( cfg . instance ) ? ` ${ cfg . instance } ` : '' } ${ cfg . database } ${ ( cfg . domain ) ? ` ${ cfg . domain } ${ cfg . encrypt } ` : ` ${ cfg . encrypt } ` } ` ; return co ( function * gen ( ) { logger . info ( 'Connecting to the database' ) ; connection = new cosql . Connection ( conString ) ; connection . on ( 'error' , err => this . emit ( 'error' , err ) ) ; yield connection . connect ( ) ; logger . info ( 'Connection established' ) ; } . bind ( this ) ) ; }
This function will be called on component initialization
 @param cfg
This function will be called on component initialization @param cfg