-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Azure Tables Sync and Async Code Snippets #12169
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
Merged
Merged
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
b945b82
Add examples.
conniey 2805b2e
rebase with changes that move Table to new folderCode Snippets, Sync …
eboyd23 a09b66b
stashing
eboyd23 bdce025
rebase with folder changes for tables
eboyd23 63f1967
rebase on connie's branch with test filesCode Snippets, Sync done and…
eboyd23 0d9dc52
sync + async
eboyd23 87f1baa
rebase with changes that move Table to new folderCode Snippets, Sync …
eboyd23 af877ee
stashing
eboyd23 07c6fb7
rebase with folder changes for tables
eboyd23 0840acd
Code Snippets, Sync done and Async in progress
eboyd23 5cf42ad
code snippets
eboyd23 2e07c02
delete testing from code snippets branch
eboyd23 ee74e38
adding service level client
eboyd23 330f7b5
stashing async
eboyd23 a409f80
fixed async
eboyd23 7245126
reformatting
eboyd23 044356b
fixing conflictfile name changes
eboyd23 a9a61c1
writing in docs
eboyd23 4cbcfef
fixing stash
eboyd23 bdb4d42
fixing stash2
eboyd23 c6b283a
Brandon's suggestions
eboyd23 42b1fba
stashing changes
eboyd23 40cdbf7
QueryOptions added
eboyd23 d8ff221
Added QueryOptions class
eboyd23 1b2339b
brandon comments round 2
eboyd23 c2b6dd9
delete pom from cosmos tables
eboyd23 cf4e00f
fix query options builder
eboyd23 d804bfb
fixing javadocs error
eboyd23 aba06e6
fix pom
eboyd23 0f29626
checkstyles
eboyd23 4ccbbc3
move samples
eboyd23 1550243
adding private to some local vars
eboyd23 f18d4ff
switching code samples
eboyd23 6e725d8
switch to create, update, upsert
eboyd23 68a3d3f
additional changes
eboyd23 773eb7f
edits based on comments
eboyd23 b048b1c
merge conflicts
eboyd23 c763ac9
Edits based on comments
eboyd23 58f9b78
fix void async
eboyd23 07e1baa
connie edits
eboyd23 2aef60f
fix pom
eboyd23 d83fd30
fix version
eboyd23 3416f33
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-java …
eboyd23 6120144
checkstyle errors
eboyd23 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/AzureTable.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
| package com.azure.data.tables; | ||
eboyd23 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| /** | ||
| * class for a table object | ||
| */ | ||
| public class AzureTable { | ||
eboyd23 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| private final String name; | ||
|
|
||
| AzureTable(String name) { | ||
| this.name = name; | ||
| } | ||
|
|
||
| /** | ||
| * returns the name of this table | ||
| * | ||
| * @return table name | ||
| */ | ||
| public String getName() { | ||
| return name; | ||
| } | ||
|
|
||
| /** | ||
| * returns the associated table client or null if it doesn't exist | ||
| * @return the associated table client | ||
| */ | ||
| public TableClient getClient() { | ||
| return null; | ||
| } | ||
| } | ||
79 changes: 79 additions & 0 deletions
79
sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/QueryOptions.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| package com.azure.data.tables; | ||
|
|
||
| import com.azure.core.annotation.Fluent; | ||
|
|
||
| /** | ||
| * helps construct a query | ||
| */ | ||
| @Fluent | ||
| public final class QueryOptions { | ||
eboyd23 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| private Integer top; | ||
| private String select; | ||
| private String filter; | ||
|
|
||
| /** | ||
| * Get the top property: Maximum number of records to return. | ||
| * | ||
| * @return the top value. | ||
| */ | ||
| public Integer getTop() { | ||
| return this.top; | ||
| } | ||
|
|
||
| /** | ||
| * Set the top property: Maximum number of records to return. | ||
| * | ||
| * @param top the top value to set. | ||
| * @return the QueryOptions object itself. | ||
| */ | ||
| public QueryOptions setTop(Integer top) { | ||
| this.top = top; | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| * Get the select property: Select expression using OData notation. Limits the columns on each record to just those | ||
| * requested, e.g. "$select=PolicyAssignmentId, ResourceId". | ||
| * | ||
| * @return the select value. | ||
| */ | ||
| public String getSelect() { | ||
| return this.select; | ||
| } | ||
|
|
||
| /** | ||
| * Set the select property: Select expression using OData notation. Limits the columns on each record to just those | ||
| * requested, e.g. "$select=PolicyAssignmentId, ResourceId". | ||
| * | ||
| * @param select the select value to set. | ||
| * @return the QueryOptions object itself. | ||
| */ | ||
| public QueryOptions setSelect(String select) { | ||
| this.select = select; | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| * Get the filter property: OData filter expression. | ||
| * | ||
| * @return the filter value. | ||
| */ | ||
| public String getFilter() { | ||
| return this.filter; | ||
| } | ||
|
|
||
| /** | ||
| * Set the filter property: OData filter expression. | ||
| * | ||
| * @param filter the filter value to set. | ||
| * @return the QueryOptions object itself. | ||
| */ | ||
| public QueryOptions setFilter(String filter) { | ||
| this.filter = filter; | ||
| return this; | ||
| } | ||
| } | ||
|
|
||
106 changes: 106 additions & 0 deletions
106
sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableAsyncClient.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
| package com.azure.data.tables; | ||
|
|
||
| import com.azure.core.annotation.ServiceClient; | ||
| import com.azure.core.http.rest.PagedFlux; | ||
| import java.util.Map; | ||
| import reactor.core.publisher.Mono; | ||
|
|
||
| /** | ||
| * class for the table async client | ||
| */ | ||
| @ServiceClient( | ||
| builder = TableClientBuilder.class, | ||
| isAsync = true) | ||
| public class TableAsyncClient { | ||
| private final String tableName; | ||
|
|
||
| TableAsyncClient(String tableName) { | ||
| this.tableName = tableName; | ||
| } | ||
|
|
||
eboyd23 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| /** | ||
| * Queries and returns entities in the given table using the select and filter strings | ||
| * | ||
| * @param queryOptions the odata query object | ||
| * @return a paged flux of all the entity which fit this criteria | ||
| */ | ||
| public PagedFlux<TableEntity> queryEntities(QueryOptions queryOptions) { | ||
| return null; | ||
| } | ||
|
|
||
| /** | ||
| * returns the entity with the given rowKey and ParitionKey | ||
| * | ||
| * @param rowKey the given row key | ||
| * @param partitionKey the given partition key | ||
| * @return an entity that fits the criteria | ||
| */ | ||
| public Mono<TableEntity> get(String rowKey, String partitionKey) { | ||
| return null; | ||
| } | ||
|
|
||
| /** | ||
| * insert a TableEntity with the given properties and return that TableEntity. Property map must include | ||
| * rowKey and partitionKey | ||
| * | ||
| * @param tableEntityProperties a map of properties for the TableEntity | ||
| * @return the created TableEntity | ||
| */ | ||
| public Mono<TableEntity> createEntity(Map<String, Object> tableEntityProperties) { | ||
eboyd23 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| return Mono.empty(); | ||
| } | ||
|
|
||
| /** | ||
| * based on Mode it either inserts or merges if exists or inserts or merges if exists | ||
| * | ||
| * @param updateMode type of upsert | ||
| * @param tableEntity entity to upsert | ||
| * @return void | ||
| */ | ||
| public Mono<Void> upsertEntity(UpdateMode updateMode, TableEntity tableEntity) { | ||
| return Mono.empty(); | ||
| } | ||
|
|
||
| /** | ||
| * based on Mode it either updates or fails if it does exists or replaces or fails if it does exists | ||
| * | ||
| * @param updateMode type of update | ||
| * @param tableEntity entity to update | ||
| * @return void | ||
| */ | ||
| public Mono<Void> updateEntity(UpdateMode updateMode, TableEntity tableEntity) { | ||
| return Mono.empty(); | ||
| } | ||
eboyd23 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| /** | ||
| * deletes the given entity | ||
| * | ||
| * @param tableEntity entity to delete | ||
| * @return void | ||
| */ | ||
| public Mono<Void> deleteEntity(TableEntity tableEntity) { | ||
| return Mono.empty(); | ||
| } | ||
|
|
||
| /** | ||
| * deletes the given entity | ||
| * | ||
| * @param partitionKey the partition key | ||
| * @param rowKey the row key | ||
| * @return void | ||
| */ | ||
| public Mono<Void> deleteEntity(String partitionKey, String rowKey) { | ||
| return Mono.empty(); | ||
| } | ||
|
|
||
| /** | ||
| * returns the table name associated with the client | ||
| * | ||
| * @return table name | ||
| */ | ||
| public String getTableName() { | ||
| return tableName; | ||
| } | ||
| } | ||
99 changes: 99 additions & 0 deletions
99
sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableClient.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
| package com.azure.data.tables; | ||
|
|
||
| import com.azure.core.annotation.ServiceClient; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
|
|
||
| /** | ||
| * sync client for table operations | ||
| */ | ||
| @ServiceClient( | ||
| builder = TableClientBuilder.class) | ||
| public class TableClient { | ||
| final String tableName; | ||
|
|
||
| TableClient(String tableName) { | ||
| this.tableName = tableName; | ||
| } | ||
|
|
||
| /** | ||
| * Queries and returns entities in the given table using the select and filter strings | ||
| * | ||
| * @param queryOptions the odata query object | ||
| * @return a list of the tables that fit the query | ||
| */ | ||
| public List<TableEntity> queryEntities(QueryOptions queryOptions) { | ||
| return null; | ||
| } | ||
|
|
||
| /** | ||
| * returns the entity with the given rowKey and ParitionKey | ||
| * | ||
| * @param rowKey the given row key | ||
| * @param partitionKey the given partition key | ||
| * @return an entity that fits the criteria | ||
| */ | ||
| public TableEntity get(String rowKey, String partitionKey) { | ||
| return null; | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * insert a TableEntity with the given properties and return that TableEntity. Property map must include | ||
| * rowKey and partitionKey | ||
| * | ||
| * @param tableEntityProperties a map of properties for the TableEntity | ||
| * @return the created TableEntity | ||
| */ | ||
| public TableEntity createEntity(Map<String, Object> tableEntityProperties) { | ||
| return null; | ||
| } | ||
|
|
||
| /** | ||
| * based on Mode it either inserts or merges if exists or inserts or merges if exists | ||
| * | ||
| * @param updateMode type of upsert | ||
| * @param tableEntity entity to upsert | ||
| */ | ||
| public void upsertEntity(UpdateMode updateMode, TableEntity tableEntity) { | ||
| } | ||
|
|
||
| /** | ||
| * based on Mode it either updates or fails if it does exists or replaces or fails if it does exists | ||
| * | ||
| * @param updateMode type of update | ||
| * @param tableEntity entity to update | ||
| */ | ||
| public void updateEntity(UpdateMode updateMode, TableEntity tableEntity) { | ||
| } | ||
|
|
||
| /** | ||
| * deletes the given entity | ||
| * | ||
| * @param tableEntity entity to delete | ||
| */ | ||
| public void deleteEntity(TableEntity tableEntity) { | ||
| } | ||
|
|
||
| /** | ||
| * deletes the given entity | ||
| * | ||
| * @param partitionKey the partition key | ||
| * @param rowKey the row key | ||
| */ | ||
| public void deleteEntity(String partitionKey, String rowKey) { | ||
| } | ||
|
|
||
| /** | ||
| * returns the table name associated with the client | ||
| * | ||
| * @return table name | ||
| */ | ||
| public String getTableName() { | ||
| return this.tableName; | ||
| } | ||
|
|
||
|
|
||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.