Commit cf9983d
samples: Add sample snippets for count aggregations (#871)
* Add method in Datastore client to invoke rpc for aggregation query
* Creating count aggregation and using it to populate Aggregation proto
* Moving aggregation builder method to root level aggregation class
* Introducing RecordQuery to represent queries which returns entity records when executed
* Updating gitignore with patch extension
* Setting up structure of Aggregation query and its builder
* Introducing ProtoPreparer to populate the request protos
* Delegating responsibility of preparing query proto to QueryPreparer
* Populating aggregation query with nested structured query
* Delegating responsibility of preparing query proto in GqlQuery to QueryPreparer
* Removing RecordQuery from the query hierarchy and making it a standalone interface for now
* Populating aggregation query with nested gql query
* Removing deprecation warning by using assertThrows instead of ExpectedException rule
* Making DatastoreRpc call aggregation query method on client
* Creating response transformer to transform aggregation query response into domain objects
* Implementing aggregation query executor to execute AggergationQuery
* Adding missing assertion statements
* Creating RetryExecutor to inject it as a dependency in other components
* Making RetryExecutor accept RetrySettings when creating it
* Revert "Making RetryExecutor accept RetrySettings when creating it"
This reverts commit 1dfafb7.
* Revert "Creating RetryExecutor to inject it as a dependency in other components"
This reverts commit 8872a55.
* Introducing RetryAndTraceDatastoreRpcDecorator to have retry and traceability logic on top of another DatastoreRpc
* Extracting out the responsibility of preparing ReadOption in it's own ProtoPreparer
* Making QueryExecutor to execute query with provided ReadOptions
* Exposing readTime to the user
* Ignoring runAggregationQuery method from clirr check
* Making readTime final
* Allowing namespace to be optional in AggregationQuery
* Add capability to fetch aggregation result by passing alias
* Implementing User facing datastore.runAggrgation method to run aggregation query
* Add integration test for count aggregation
* Add transaction Id support in ReadOptionsProtoPreparer
* Supporting aggregation query with transactions
* Allowing user to create Aggregation directly without involving its builder
* Preventing creating duplicated aggregation when creating an aggregation query
* Marking RecordQuery implemented method as InternalApi
* Writing comments and JavaDoc for aggregation query related class
* Adding a default implementation in the public interfaces to avoid compile time failures
* covering a scenario to maintain consistent snapshot when executing aggregation query in a transaction
* Creating emulator proxy to simulate AggregationQuery response from emulator
* Integration test to execute an aggregation query in a read only transaction
* Count aggregation samples with structuredQuery and gql query
* Count aggregation samples to demonstrate stale read
* Getting rid off limit operation on count aggregation as same behaviour can be achieved by using 'limit' operation on the underlying query
* Removing import statement from javadoc and undo changes in .gitignore file
* Using Optional instead of returning null from ReadOptionsProtoPreparer
* using assertThat from Truth library
* Removing 'limit' api from count query samples
* fixing unit test
* Getting rid off Double braces initialization syntax
* Fixing lint
* Getting rid off emulator proxy and using easy mock to check the aggregationQuery triggered
* Deleting a entity created locally in other test which is causing failure in other test
* Deleting all keys in datastore in integration test so that new test can start fresh
* Executing two read write transaction simultaneously and verifying their behaviour
* Removing tests to verify serializability as it's an underlying implementation detail
* Fixing lint
* Adding runAggregationQuery method to reflect config so that it's available and accessible in native image through reflection
* Aggregation query samples with limit and order by option
* Aggregation query samples with transactions
* fixing lint and reusing sysoutRule
* correcting region tag
* simplifying tearDown method
* Reverting back to using Task domain for aggregation query samples
* Limiting tearDown method to delete only Task entities
* Splitting count aggregation query samples into individual java files
* 🦉 Updates from OwlBot post-processor
See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md
* Adding missing header
* Sticking to the practise of deleting the old created data in setUp of test
* Moving comment to the top of statement.
Co-authored-by: Sita Lakshmi Sangameswaran <[email protected]>
* Making builder syntax multiline
Co-authored-by: Sita Lakshmi Sangameswaran <[email protected]>
* Adding comment describing the purpose of GQL query
Co-authored-by: Sita Lakshmi Sangameswaran <[email protected]>
* Rephrasing the comment
Co-authored-by: Sita Lakshmi Sangameswaran <[email protected]>
* Adding a comment describing the purpose of the GQL query
Co-authored-by: Sita Lakshmi Sangameswaran <[email protected]>
* Rephrasing the comment
Co-authored-by: Sita Lakshmi Sangameswaran <[email protected]>
* Relocating region tags to include import statments
* Few styling and comment fixes
* Adding comment in the transaction block
* Adding fullstop to the comment lines
* Showcasing with/without alias usage separately
* Importing static methods are we are now including import statements in samples
* 🦉 Updates from OwlBot post-processor
See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Sita Lakshmi Sangameswaran <[email protected]>1 parent e48e7fc commit cf9983d
File tree
11 files changed
+734
-13
lines changed- samples/snippets/src
- main/java/com/example/datastore/aggregation
- test/java/com
- example/datastore
- rule
11 files changed
+734
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
237 | 244 | | |
238 | 245 | | |
239 | 246 | | |
| |||
Lines changed: 85 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
Lines changed: 90 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
samples/snippets/src/main/java/com/example/datastore/aggregation/CountAggregationWithGqlQuery.java
Lines changed: 87 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
Lines changed: 65 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
0 commit comments