You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

21 rivejä
597 B

  1. module.exports = {
  2. exists: async function(value, options) {
  3. if (!value) return true;
  4. const db = this.getDbConnection(options.connection);
  5. const results = await db.from(options.table).where(options.column, value).limit(1);
  6. return results.length > 0;
  7. },
  8. notexists: async function(value, options) {
  9. if (!value) return true;
  10. const db = this.getDbConnection(options.connection);
  11. const results = await db.from(options.table).where(options.column, value).limit(1);
  12. return results.length == 0;
  13. }
  14. };