Skip to content

Commit

Permalink
added async methods for named query
Browse files Browse the repository at this point in the history
  • Loading branch information
Bero committed Oct 22, 2024
1 parent 1f8412e commit 308f88f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/namedQuery/namedQuery.client.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,16 @@ export default class extends Base {
subscriptionHandle: this.subscriptionHandle
});
}

async fetchOneAsync() {
return this.fetchOneSync();
}

async fetchAsync() {
return this.fetchSync();
}

async getCountAsync() {
return this.getCountSync();
}
}
12 changes: 12 additions & 0 deletions lib/namedQuery/namedQuery.server.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ export default class extends Base {
}
}

async fetchAsync(context = {}) {
return await this.fetch(context);
}

/**
* @param args
* @returns {*}
Expand All @@ -47,6 +51,10 @@ export default class extends Base {
return _.first(this.fetch(...args));
}

async fetchOneAsync(context = {}) {
return await this.fetchOne(context);
}

/**
* Gets the count of matching elements.
*
Expand All @@ -66,6 +74,10 @@ export default class extends Base {
return countCursor.count();
}

async getCountAsync(context = {}) {
return this.getCount(context);
}

/**
* Returns the cursor for counting
* This is most likely used for counts cursor
Expand Down

0 comments on commit 308f88f

Please sign in to comment.