How to use the promise-mysql.format function in promise-mysql

To help you get started, we’ve selected a few promise-mysql examples, based on popular ways it is used in public projects.

github LeadcoinNetwork / Web-App-Project / backend / models / mysql-pool / mysql-pool.ts View on Github external
public async query(...args): Promise<queryResult> {
    var query = mysql.format(...args)
    try {
      var result = await this.pool.query(query)
    } catch (err) {
      this.log("query", { error: err.message, query })
      throw err
    }
    this.log("query", { query, result })
    return result
  }
  private async checkdb() {
github Bjorn248 / graphql_aws_pricing_api / server / src / server.ts View on Github external
const queryIdentifiers = [];
  queryIdentifiers.push(tableName);
  if (Object.keys(args).length !== 0) {
    queryString += ' WHERE ';
    Object.keys(args).forEach(function(arg, index) {
      if (index > 0) {
        queryString += ' AND ';
      }
      queryString += '?? = ?';
      queryIdentifiers.push(arg);
      queryIdentifiers.push(args[arg]);
    });
  }

  queryIdentifiers.unshift(selectionColumns);
  queryString = format(queryString, queryIdentifiers);
  return pool.query(queryString);
};
export const generateFieldFunction = FieldMap => () => FieldMap;

promise-mysql

A bluebird wrapper for node-mysql

MIT
Latest version published 5 months ago

Package Health Score

70 / 100
Full package analysis

Similar packages