How to use the mysql2/promise.format function in mysql2

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

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github connect-foundation / 2019-06 / infra / maildb / src / format.js View on Github external
const getQueryToFindOwnerAndCategoryNo = (id, sender = false) => {
  return mysql.format(QUERY.SELECT, [
    IDENTIFIER.USER_NO,
    VALUE.OWNER,
    IDENTIFIER.CATEGORY_NO,
    [TABLE.USER, TABLE.CATEGORY],
    IDENTIFIER.USER_NO,
    IDENTIFIER.CATEGORY_USER_NO,
    IDENTIFIER.ID,
    id,
    IDENTIFIER.CATEGOTY_NAME,
    sender ? VALUE.SENT_MAILBOX : VALUE.MAILBOX
  ]);
};
github connect-foundation / 2019-06 / infra / maildb / src / format.js View on Github external
text,
  html,
  attachments
}) => {
  const valueOfMailTemplate = {
    from,
    to,
    subject,
    text,
    html,
    created_at: VALUE.NOW,
    updated_at: VALUE.NOW,
    has_attachment: attachments.length !== 0
  };

  return mysql.format(QUERY.INSERT, [TABLE.MAIL_TEMPLATE, valueOfMailTemplate]);
};