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(core-manager): implement database query support #3780

Merged
merged 9 commits into from
Jun 8, 2020

Conversation

sebastijankuzner
Copy link
Contributor

Summary

This PR introduces possibility to query watcher sqlite database including querying JSON objects with nested structure. All query parameters have prefix $.

Symbol Description
$limit Limit database result. Placed in the query object root.
$offset Offset database result. Placed in the query object root.
$eq Equal.
$ne Not equal.
$like Like.
$lt Less than.
$lte Less than or equal.
$gt Greater than.
$gte Greater than or equal.

Example:

{ "$limit": 100, "$offset": 0, "data": { "value": { "username": "genesis_9" } } }

Load top 100 results with 0 offset where data JOSN object has value.username propery equal to "genesis_9".

Checklist

  • Tests
  • Ready to be merged

@codecov
Copy link

codecov bot commented Jun 8, 2020

Codecov Report

Merging #3780 into develop will increase coverage by 1.31%.
The diff coverage is 77.14%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #3780      +/-   ##
===========================================
+ Coverage    89.40%   90.71%   +1.31%     
===========================================
  Files          615      615              
  Lines        13558    13585      +27     
  Branches      1527     1535       +8     
===========================================
+ Hits         12121    12324     +203     
+ Misses         313      139     -174     
+ Partials      1124     1122       -2     
Impacted Files Coverage Δ
packages/core-manager/src/database-service.ts 83.60% <76.47%> (-4.63%) ⬇️
...ges/core-manager/src/actions/watcher-get-events.ts 100.00% <100.00%> (ø)
packages/core-database/src/utils/query-helper.ts 100.00% <0.00%> (+2.04%) ⬆️
...s/core-database/src/utils/snake-naming-strategy.ts 81.81% <0.00%> (+9.09%) ⬆️
packages/core-database/src/utils/transform.ts 93.75% <0.00%> (+31.25%) ⬆️
...core-database/src/repositories/round-repository.ts 100.00% <0.00%> (+57.14%) ⬆️
...atabase/src/repositories/transaction-repository.ts 94.44% <0.00%> (+75.00%) ⬆️
...e-database/src/repositories/abstract-repository.ts 85.10% <0.00%> (+76.59%) ⬆️
...core-database/src/repositories/block-repository.ts 93.33% <0.00%> (+83.33%) ⬆️
...rc/migrations/20190307000000-drop-wallets-table.ts 100.00% <0.00%> (+100.00%) ⬆️
... and 19 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7c348e1...52e5402. Read the comment docs.

@faustbrian faustbrian merged commit 8a2033a into develop Jun 8, 2020
@ghost ghost deleted the feat/core-manager/query-database branch June 8, 2020 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants