Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Derive the count of a limited dare.get request #81

Closed
MrSwitch opened this issue Aug 14, 2019 · 1 comment · Fixed by #87
Closed

feat: Derive the count of a limited dare.get request #81

MrSwitch opened this issue Aug 14, 2019 · 1 comment · Fixed by #87
Labels

Comments

@MrSwitch
Copy link
Member

MrSwitch commented Aug 14, 2019

This ticket supersedes #31.

Obtain the number of rows a count request would have retrieved had it not been limited.

e.g.

// Request with a limit
const dataset = dare.get(request);

// How many rows matched to generate pagination
const count = dare.getCount(request);

Approach

Create a new function dare.getCount(request). This will be able to take an existing request object in the first parameter and retrieve the number of records which match this query.

This can be done by stripping away any fields, orderby, limit and start props.
Defining a single field containing COUNT(DISTINCT ${groupby}) where groupby is any custom or derived groupby applied to the matching dataset.

MrSwitch added a commit that referenced this issue Sep 4, 2019
MrSwitch added a commit that referenced this issue Sep 4, 2019
@MrSwitch MrSwitch mentioned this issue Sep 5, 2019
MrSwitch pushed a commit that referenced this issue Sep 5, 2019
# [0.34.0](v0.33.1...v0.34.0) (2019-09-05)

### Features

* **get:** shallow clone the request object to prevent mutation, [#81](#81) ([d7791f5](d7791f5))
* **getCount:** Add Dare getCount to run the request and retrieve the number of matching results, [#81](#81) ([9ee95f6](9ee95f6))
* **getCount:** clone the request object to prevent mutation, [#81](#81) ([17293b7](17293b7))
MrSwitch added a commit that referenced this issue Sep 5, 2019
MrSwitch pushed a commit that referenced this issue Sep 5, 2019
## [0.34.1](v0.34.0...v0.34.1) (2019-09-05)

### Bug Fixes

* **getCount:** remove start option, [#81](#81) ([78afc8c](78afc8c))
* **package:** refactor, but also trigger semantic release ([5ab2200](5ab2200))
* **package:** refactor, but also trigger semantic release ([75fc5b1](75fc5b1))
MrSwitch added a commit that referenced this issue Sep 5, 2019
* checkin: getCount

* feat(getCount): Add Dare getCount to run the request and retrieve the number of matching results, #81

* feat(getCount): clone the request object to prevent mutation, #81

* feat(get): shallow clone the request object to prevent mutation, #81

* spec(getCount): deep clone check, #81

* docs(getCount): Initial docs for getCount, #81

* docs(getCount): mod docs for getCount, #81

* docs(getCount): mod docs for getCount, #81

* feat(dist): add deploy channel next

* feat(dist): add deploy channel next

* feat(dist): add deploy channel next

* chore(release): 0.33.0 [skip ci]

# [0.33.0](v0.32.2...v0.33.0) (2019-09-05)

### Features

* **dist:** add deploy channel next ([c0dddf6](c0dddf6))
* **dist:** add deploy channel next ([c935a87](c935a87))
* **dist:** add deploy channel next ([765d47f](765d47f))

* fix(dist): add deploy channel next

* chore(release): 0.33.1 [skip ci]

## [0.33.1](v0.33.0...v0.33.1) (2019-09-05)

### Bug Fixes

* **dist:** add deploy channel next ([9640cb8](9640cb8))

* chore(release): 0.34.0 [skip ci]

# [0.34.0](v0.33.1...v0.34.0) (2019-09-05)

### Features

* **get:** shallow clone the request object to prevent mutation, [#81](#81) ([d7791f5](d7791f5))
* **getCount:** Add Dare getCount to run the request and retrieve the number of matching results, [#81](#81) ([9ee95f6](9ee95f6))
* **getCount:** clone the request object to prevent mutation, [#81](#81) ([17293b7](17293b7))

* chore(packages): update dev dependencies

* fix(getCount): remove start option, #81

* fix(package): refactor, but also trigger semantic release

* fix(package): refactor, but also trigger semantic release

* chore(release): 0.34.1 [skip ci]

## [0.34.1](v0.34.0...v0.34.1) (2019-09-05)

### Bug Fixes

* **getCount:** remove start option, [#81](#81) ([78afc8c](78afc8c))
* **package:** refactor, but also trigger semantic release ([5ab2200](5ab2200))
* **package:** refactor, but also trigger semantic release ([75fc5b1](75fc5b1))

* chore(deploy): update npm dist-tag

* docs(jsdoc): getCount returns

* docs(README): Dare.getCount
@MrSwitch
Copy link
Member Author

🎉 This issue has been resolved in version 0.32.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant