25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

21 lines
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. };